Changeset b2c33bb in tol


Ignore:
Timestamp:
Jan 19, 2009, 8:50:02 AM (18 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
567228f
Parents:
095d51c
Message:

Fixing some Struct field types.
Allowing '?' as lower or upper bound of prior distribution of missing values.

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@425 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/btol/vmatrix_type/vmat_bsr.cpp

    r095d51c rb2c33bb  
    101101    "Text:Session.Description,"
    102102    "Text:Session.Authors,"
    103     "Text:Session.Creation,"
     103    "Date:Session.Creation,"
    104104    "Text:Path");
    105105  }
    … …  
    137137    "Real:Row,"
    138138    "Real:Col,"
    139     "Real:Prior,"
     139    "Text:Prior,"
    140140    "Real:Nu,"
    141141    "Real:Sigma2,"
    … …  
    403403template<> symbol_handler<sigma_info>*     add_symbol<sigma_info>     ::sh_   = NULL;
    404404template<> symbol_handler<noise_info>* add_symbol<noise_info> ::sh_   = NULL;
     405
     406
     407///////////////////////////////////////////////////////////////////////////////
     408struct assign_missing_min
     409///////////////////////////////////////////////////////////////////////////////
     410{
     411  static symbol_handler<missing_info>*  mis_;
     412 
     413  static void action(const double d)
     414  {
     415    mis_->info.minBound  = d;
     416  }
     417  static void action(const std::string& str)
     418  {
     419    if(str=="?")
     420    {
     421      action(BDat::NegInf());
     422    }
     423    else
     424    {
     425      action(atof(str.c_str()));
     426    }
     427  }
     428  void operator()(const double d) const
     429  {
     430    action(d);
     431  }
     432  void operator()(const std::string& str) const
     433  {
     434    action(str);
     435  }
     436  void operator()(const char* str) const
     437  {
     438    action(str);
     439  }
     440  template<typename IteratorT>
     441  void operator()(IteratorT first, IteratorT last) const
     442  {
     443    std::string str;
     444    str.assign(first, last);
     445    action(str);
     446  }
     447};
     448symbol_handler<missing_info>* assign_missing_min::mis_  = NULL;
     449
     450///////////////////////////////////////////////////////////////////////////////
     451struct assign_missing_max
     452///////////////////////////////////////////////////////////////////////////////
     453{
     454  static symbol_handler<missing_info>*  mis_;
     455 
     456  static void action(const double d)
     457  {
     458    mis_->info.maxBound  = d;
     459  }
     460  static void action(const std::string& str)
     461  {
     462    if(str=="?")
     463    {
     464      action(BDat::PosInf());
     465    }
     466    else
     467    {
     468      action(atof(str.c_str()));
     469    }
     470  }
     471  void operator()(const double d) const
     472  {
     473    action(d);
     474  }
     475  void operator()(const char* str) const
     476  {
     477    action(str);
     478  }
     479  void operator()(const std::string& str) const
     480  {
     481    action(str);
     482  }
     483  template<typename IteratorT>
     484  void operator()(IteratorT first, IteratorT last) const
     485  {
     486    std::string str;
     487    str.assign(first, last);
     488    action(str);
     489  }
     490};
     491symbol_handler<missing_info>* assign_missing_max::mis_  = NULL;
    405492
    406493
    … …  
    11871274      add_symbol<noise_info>::sh_ = &s.noise;
    11881275      add_symbol<noise_info> add_res;
     1276
     1277      assign_missing_min::mis_  = &s.mis;
     1278      assign_missing_min assign_missing_min_;
     1279      assign_missing_max::mis_  = &s.mis;
     1280      assign_missing_max assign_missing_max_;
    11891281
    11901282      assign_noise_size::noise_info_  = &s.noise.info;
    … …  
    16051697                (real_p[assign_a(s.mis.info.sigma2)] | error_badNumber)>>
    16061698                argumentSeparator >>
    1607                 (real_p[assign_a(s.mis.info.minBound)] | error_badNumber)>>
     1699                ((str_p("?")|real_p)[assign_missing_min_] | error_badNumber) >>
    16081700                argumentSeparator >>
    1609                 (real_p[assign_a(s.mis.info.maxBound)] | error_badNumber) >>
     1701                ((str_p("?")|real_p)[assign_missing_max_] | error_badNumber) >>
    16101702                closeParenthesys
    16111703              )
Note: See TracChangeset for help on using the changeset viewer.