Changeset 141 for bdm/stat/emix.h

Show
Ignore:
Timestamp:
08/18/08 14:28:08 (16 years ago)
Author:
smidl
Message:

Opraveny warningy

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • bdm/stat/emix.h

    r124 r141  
    3030 
    3131*/ 
    32 class emix : public epdf { 
    33 protected: 
    34         //! weights of the components 
    35         vec w; 
    36         //! Component (epdfs) 
    37         Array<epdf*> Coms; 
    38 public: 
    39         //!Default constructor 
    40         emix ( RV &rv ) : epdf ( rv ) {}; 
    41         //! Set weights \c w and components \c R 
    42         void set_parameters ( const vec &w, const Array<epdf*> &Coms ); 
     32class emix : public epdf 
     33{ 
     34        protected: 
     35                //! weights of the components 
     36                vec w; 
     37                //! Component (epdfs) 
     38                Array<epdf*> Coms; 
     39        public: 
     40                //!Default constructor 
     41                emix ( RV &rv ) : epdf ( rv ) {}; 
     42                //! Set weights \c w and components \c R 
     43                void set_parameters ( const vec &w, const Array<epdf*> &Coms ); 
    4344 
    44         vec sample() const; 
    45         vec mean() const { 
    46                 int i; vec mu=zeros ( rv.count() ); 
    47                 for ( i=0;i<w.length();i++ ) {mu+=w ( i ) *Coms ( i )->mean(); } 
    48                 return mu; 
    49         } 
    50         double evalpdflog ( const vec &val ) const { 
    51                 int i; 
    52                 double sum=0.0; 
    53                 for ( i=0;i<w.length();i++ ) {sum+=w ( i ) *Coms ( i )->evalpdflog ( val );} 
    54                 return log ( sum ); 
    55         }; 
     45                vec sample() const; 
     46                vec mean() const 
     47                { 
     48                        int i; vec mu=zeros ( rv.count() ); 
     49                        for ( i=0;i<w.length();i++ ) {mu+=w ( i ) *Coms ( i )->mean(); } 
     50                        return mu; 
     51                } 
     52                double evalpdflog ( const vec &val ) const 
     53                { 
     54                        int i; 
     55                        double sum=0.0; 
     56                        for ( i=0;i<w.length();i++ ) {sum+=w ( i ) *Coms ( i )->evalpdflog ( val );} 
     57                        return log ( sum ); 
     58                }; 
    5659 
    5760//Access methods 
    58         //! returns a pointer to the internal mean value. Use with Care! 
    59         vec& _w() {return w;} 
     61                //! returns a pointer to the internal mean value. Use with Care! 
     62                vec& _w() {return w;} 
    6063}; 
    6164 
     
    6467 
    6568*/ 
    66 class eprod: public epdf { 
    67 protected: 
    68         Array<epdf*> epdfs; 
    69         Array<mpdf*> mpdfs; 
    70 public: 
     69class eprod: public epdf 
     70{ 
     71        protected: 
     72                Array<epdf*> epdfs; 
     73                Array<mpdf*> mpdfs; 
     74        public: 
    7175 
    7276 
     
    7680 
    7781*/ 
    78 class mmix : public mpdf { 
    79 protected: 
    80         //! Component (epdfs) 
    81         Array<mpdf*> Coms; 
    82         //!Internal epdf 
    83         emix Epdf; 
    84 public: 
    85         //!Default constructor 
    86         mmix ( RV &rv, RV &rvc ) : mpdf ( rv, rvc ), Epdf ( rv ) {ep=&Epdf;}; 
    87         //! Set weights \c w and components \c R 
    88         void set_parameters ( const vec &w, const Array<mpdf*> &Coms ) { 
    89                 Array<epdf*> Eps ( Coms.length()); 
     82class mmix : public mpdf 
     83{ 
     84        protected: 
     85                //! Component (epdfs) 
     86                Array<mpdf*> Coms; 
     87                //!Internal epdf 
     88                emix Epdf; 
     89        public: 
     90                //!Default constructor 
     91                mmix ( RV &rv, RV &rvc ) : mpdf ( rv, rvc ), Epdf ( rv ) {ep=&Epdf;}; 
     92                //! Set weights \c w and components \c R 
     93                void set_parameters ( const vec &w, const Array<mpdf*> &Coms ) 
     94                { 
     95                        Array<epdf*> Eps ( Coms.length() ); 
    9096 
    91                 for ( int i=0;i<Coms.length();i++ ) {mpdf* Ci=Coms(i); 
    92                  Eps ( i ) =& ( Coms ( i )->_epdf() );} 
    93                 Epdf.set_parameters ( w,Eps ); 
    94         }; 
     97                        for ( int i=0;i<Coms.length();i++ ) 
     98                        { 
     99                                Eps ( i ) =& ( Coms ( i )->_epdf() ); 
     100                        } 
     101                        Epdf.set_parameters ( w,Eps ); 
     102                }; 
    95103 
    96         void condition ( const vec &cond ) { 
    97                 for ( int i=0;i<Coms.length();i++ ) {Coms ( i )->condition ( cond );} 
    98         }; 
     104                void condition ( const vec &cond ) 
     105                { 
     106                        for ( int i=0;i<Coms.length();i++ ) {Coms ( i )->condition ( cond );} 
     107                }; 
    99108}; 
    100109#endif //MX_H