Changeset 1432 for trunk/yat/utility


Ignore:
Timestamp:
Aug 25, 2008, 3:54:18 PM (13 years ago)
Author:
Peter
Message:

refs #416 moving quantile normalizer to new dir. Also moved the algorithm to a class (rather than free function).

Location:
trunk/yat/utility
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/utility.cc

    r1419 r1432  
    7575
    7676
    77   void quantile_normalize(Matrix& data)
    78   {
    79     Matrix data_copy(data);
    80    
    81     // sort columns in copy
    82     for (size_t column=0; column<data_copy.columns(); ++column){
    83       std::sort(data_copy.begin_column(column), data_copy.end_column(column));
    84     }
    85 
    86     // calculate average of each row
    87     std::vector<yat::statistics::Averager> averager(data_copy.rows());
    88     for (size_t row=0; row<data_copy.rows(); ++row){
    89       add(averager[row], data_copy.begin_row(row), data_copy.end_row(row));
    90     }
    91 
    92     for (size_t column=0; column<data.columns(); ++column){
    93       std::vector<size_t> index;
    94       yat::utility::sort_index(index, data.column_const_view(column));
    95                                
    96       for (size_t row=0; row<data.rows(); ++row)
    97         data(index[row], column) = averager[row].mean();
    98     }
    99   }
    100 
    101 
    102 
    10377}}} // end of namespace utility, yat and thep
  • trunk/yat/utility/utility.h

    r1401 r1432  
    9898  bool is_nan(const std::string& s);
    9999
    100   /**
    101      \brief Perform quantile normalization
    102 
    103      \since New in yat 0.5
    104    */
    105   void quantile_normalize(Matrix&);
    106 
    107100  // template implementations
    108101  template<typename T>
Note: See TracChangeset for help on using the changeset viewer.