Changeset 1054


Ignore:
Timestamp:
May 7, 2009, 12:41:50 AM (12 years ago)
Author:
Jari Häkkinen
Message:

Cleaned up iterator usage in qQN.cc

Location:
plugins/base2/net.sf.basedb.normalizers/trunk/src/c++
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/c++/bin/qQN.cc

    r1053 r1054  
    4848                   const std::string&);
    4949
    50 void exp_numbers(MatrixWeighted&);
     50template<typename Iterator> void exp_numbers(Iterator first, Iterator last);
    5151template<typename Iterator> void log_numbers(Iterator first, Iterator last);
    52 void log_numbers(MatrixWeighted&);
    5352
    5453/**
     
    109108                      create_target(target,m) );
    110109  log_numbers(target.begin(),target.end());
    111   log_numbers(m);
     110  log_numbers(m.begin(),m.end());
    112111  qQuantileNormalizer qqn(target.begin(), target.end(), 100);
    113112  ColumnNormalizer<qQuantileNormalizer> cn(qqn);
    114113  MatrixWeighted result(m.rows(),m.columns());
    115114  cn(m,result);
    116   exp_numbers(result);
     115  exp_numbers(result.begin(),result.end());
    117116
    118117  std::ofstream* outfile=NULL;
     
    184183
    185184
    186 void exp_numbers(MatrixWeighted& m)
    187 {
    188   MatrixWeighted::iterator i=m.begin();
    189   while (i!=m.end()) {
    190     i->data() =std::exp(i->data());
     185template<typename Iterator> void exp_numbers(Iterator i, Iterator last)
     186{
     187  while (i!=last) {
     188    *data_iterator(i)=std::exp(*data_iterator(i));
    191189    ++i;
    192190  }
     
    197195{
    198196  while (i!=last) {
    199     *i=std::log(*i);
    200     ++i;
    201   }
    202 }
    203 
    204 
    205 void log_numbers(MatrixWeighted& m)
    206 {
    207   MatrixWeighted::iterator i=m.begin();
    208   while (i!=m.end()) {
    209     i->data() =std::log(i->data());
     197    *data_iterator(i)=std::log(*data_iterator(i));
    210198    ++i;
    211199  }
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/c++/configure.ac

    r1052 r1054  
    6969else
    7070  yat_found="no"
    71   yat_version="0.5.3"
     71  yat_version="0.5.2"
    7272  YAT_CHECK_YAT([${yat_version}],[yat_found="yes"])
    7373  if (test "${yat_found}" = "yes") ; then
Note: See TracChangeset for help on using the changeset viewer.