Show
Ignore:
Timestamp:
08/19/09 16:54:24 (15 years ago)
Author:
vbarta
Message:

using own error macros (basically copied from IT++, but never aborting)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/stat/exp_family.h

    r536 r565  
    4444                //! logarithm of the normalizing constant, \f$\mathcal{I}\f$ 
    4545                virtual double lognc() const = 0; 
     46 
    4647                //!Evaluate normalized log-probability 
    47                 virtual double evallog_nn (const vec &val) const{it_error ("Not implemented");return 0.0;}; 
     48                virtual double evallog_nn (const vec &val) const { 
     49                        bdm_error ("Not implemented"); 
     50                        return 0.0; 
     51                } 
     52 
    4853                //!Evaluate normalized log-probability 
    4954                virtual double evallog (const vec &val) const { 
    5055                        double tmp; 
    5156                        tmp = evallog_nn (val) - lognc(); 
    52 //                              it_assert_debug ( std::isfinite ( tmp ),"Infinite value" ); 
    5357                        return tmp; 
    5458                } 
     
    6569                        return x -lognc(); 
    6670                } 
     71 
    6772                //!Power of the density, used e.g. to flatten the density 
    68                 virtual void pow (double p) {it_error ("Not implemented");}; 
     73                virtual void pow (double p) { 
     74                        bdm_error ("Not implemented"); 
     75                } 
    6976}; 
    7077 
     
    8491                BMEF (const BMEF &B) : BM (B), frg (B.frg), last_lognc (B.last_lognc) {} 
    8592                //!get statistics from another model 
    86                 virtual void set_statistics (const BMEF* BM0) {it_error ("Not implemented");}; 
     93                virtual void set_statistics (const BMEF* BM0) { 
     94                        bdm_error ("Not implemented"); 
     95                } 
     96 
    8797                //! Weighted update of sufficient statistics (Bayes rule) 
    8898                virtual void bayes (const vec &data, const double w) {}; 
    8999                //original Bayes 
    90100                void bayes (const vec &dt); 
     101 
    91102                //!Flatten the posterior according to the given BMEF (of the same type!) 
    92                 virtual void flatten (const BMEF * B) {it_error ("Not implemented");} 
    93                 //!Flatten the posterior as if to keep nu0 data 
    94 //      virtual void flatten ( double nu0 ) {it_error ( "Not implemented" );} 
    95  
    96                 BMEF* _copy_ () const {it_error ("function _copy_ not implemented for this BM"); return NULL;}; 
     103                virtual void flatten (const BMEF * B) { 
     104                        bdm_error ("Not implemented"); 
     105                } 
     106 
     107                BMEF* _copy_ () const { 
     108                        bdm_error ("function _copy_ not implemented for this BM"); 
     109                        return NULL; 
     110                } 
    97111}; 
    98112 
     
    122136                void from_setting (const Setting &root); 
    123137                void validate() { 
    124                         it_assert (mu.length() == R.rows(), "parameters mismatch"); 
     138                        bdm_assert_debug (mu.length() == R.rows(), "parameters mismatch"); 
    125139                        dim = mu.length(); 
    126140                } 
     
    272286                //!@} 
    273287 
    274                 vec sample() const {it_error ("Not implemented");return vec_1 (0.0);}; 
     288                vec sample() const { 
     289                        bdm_error ("Not implemented"); 
     290                        return vec(); 
     291                } 
     292 
    275293                vec mean() const {return beta / sum (beta);}; 
    276294                vec variance() const {double gamma = sum (beta); return elem_mult (beta, (beta + 1)) / (gamma* (gamma + 1));} 
     
    278296                double evallog_nn (const vec &val) const { 
    279297                        double tmp; tmp = (beta - 1) * log (val); 
    280 //                              it_assert_debug ( std::isfinite ( tmp ),"Infinite value" ); 
    281298                        return tmp; 
    282                 }; 
     299                } 
     300 
    283301                double lognc () const { 
    284302                        double tmp; 
     
    287305                        for (int i = 0;i < beta.length();i++) {lgb += lgamma (beta (i));} 
    288306                        tmp = lgb - lgamma (gam); 
    289 //                              it_assert_debug ( std::isfinite ( tmp ),"Infinite value" ); 
    290307                        return tmp; 
    291                 }; 
     308                } 
     309 
    292310                //!access function 
    293311                vec& _beta()  {return beta;} 
     
    397415                } 
    398416                void validate() { 
    399                         it_assert (alpha.length() == beta.length(), "parameters do not match"); 
     417                        bdm_assert_debug (alpha.length() == beta.length(), "parameters do not match"); 
    400418                        dim = alpha.length(); 
    401419                } 
     
    446464        void set_parameters( int &i, double wi, epdf* ep){w(i)=wi;Coms(i)=ep;} 
    447465        vec mean(){vec pom; for(int i=0;i<n;i++){pom+=Coms(i)->mean()*w(i);} return pom;}; 
    448         vec sample() {it_error ( "Not implemented" );return 0;} 
    449466}; 
    450467*/ 
     
    472489                void set_parameters (const vec &low0, const vec &high0) { 
    473490                        distance = high0 - low0; 
    474                         it_assert_debug (min (distance) > 0.0, "bad support"); 
     491                        bdm_assert_debug (min (distance) > 0.0, "bad support"); 
    475492                        low = low0; 
    476493                        high = high0; 
     
    535552                //! Set \c A and \c R 
    536553                void set_parameters (const  mat &A0, const vec &mu0, const sq_T &R0) { 
    537                         it_assert_debug (A0.rows() == mu0.length(), ""); 
    538                         it_assert_debug (A0.rows() == R0.rows(), ""); 
     554                        bdm_assert_debug (A0.rows() == mu0.length(), "mlnorm: A vs. mu mismatch"); 
     555                        bdm_assert_debug (A0.rows() == R0.rows(), "mlnorm: A vs. R mismatch"); 
    539556 
    540557                        this->iepdf.set_parameters (zeros (A0.rows()), R0); 
     
    660677                //! constructor function 
    661678                void set_parameters (const mat &A0, const vec &mu0, const ldmat &R0, const ldmat& Lambda0) { 
    662                         it_assert_debug (A0.rows() == mu0.length(), ""); 
    663                         it_assert_debug (R0.rows() == A0.rows(), ""); 
     679                        bdm_assert_debug (A0.rows() == mu0.length(), "mlstudent: A vs. mu mismatch"); 
     680                        bdm_assert_debug (R0.rows() == A0.rows(), "mlstudent: A vs. R mismatch"); 
    664681 
    665682                        iepdf.set_parameters (mu0, Lambda);  // 
     
    11381155                //! Function performs resampling, i.e. removal of low-weight samples and duplication of high-weight samples such that the new samples represent the same density. 
    11391156                ivec resample (RESAMPLING_METHOD method = SYSTEMATIC); 
    1140                 //! inherited operation : NOT implemneted 
    1141                 vec sample() const {it_error ("Not implemented");return 0;} 
    1142                 //! inherited operation : NOT implemneted 
    1143                 double evallog (const vec &val) const {it_error ("Not implemented");return 0.0;} 
     1157 
     1158                //! inherited operation : NOT implemented 
     1159                vec sample() const { 
     1160                        bdm_error ("Not implemented"); 
     1161                        return vec(); 
     1162                } 
     1163 
     1164                //! inherited operation : NOT implemented 
     1165                double evallog (const vec &val) const { 
     1166                        bdm_error ("Not implemented"); 
     1167                        return 0.0; 
     1168                } 
     1169 
    11441170                vec mean() const { 
    11451171                        vec pom = zeros (dim); 
     
    12791305void enorm<sq_T>::marginal ( const RV &rvn, enorm<sq_T> &target ) const 
    12801306{ 
    1281         it_assert_debug (isnamed(), "rv description is not assigned"); 
     1307        bdm_assert_debug (isnamed(), "rv description is not assigned"); 
    12821308        ivec irvn = rvn.dataind (rv); 
    12831309 
     
    13021328        typedef mlnorm<sq_T> TMlnorm; 
    13031329 
    1304         it_assert_debug (isnamed(), "rvs are not assigned"); 
     1330        bdm_assert_debug (isnamed(), "rvs are not assigned"); 
    13051331        TMlnorm &uptarget = dynamic_cast<TMlnorm &>(target); 
    13061332 
    13071333        RV rvc = rv.subt (rvn); 
    1308         it_assert_debug ( (rvc._dsize() + rvn._dsize() == rv._dsize()), "wrong rvn"); 
     1334        bdm_assert_debug ( (rvc._dsize() + rvn._dsize() == rv._dsize()), "wrong rvn"); 
    13091335        //Permutation vector of the new R 
    13101336        ivec irvn = rvn.dataind (rv);