Changeset 1067


Ignore:
Timestamp:
May 14, 2009, 7:05:35 PM (12 years ago)
Author:
Jari Häkkinen
Message:

Addresses #118. Forcing negative and 0 intensities to be NaNs? with 0 weight.

File:
1 edited

Legend:

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

    r1062 r1067  
    3939#include <cstdlib>
    4040#include <fstream>
     41#include <functional>
    4142#include <iostream>
     43#include <limits>
    4244#include <stdexcept>
    4345
    4446using namespace theplu::yat::normalizer;
    4547using namespace theplu::yat::utility;
     48
     49
     50class CleanUpMatrix : std::unary_function<double, double>
     51{
     52public:
     53  CleanUpMatrix(void) {}
     54
     55  inline DataWeight operator()(DataWeight x) const
     56    { return ( x.data()>0 ?
     57               x : DataWeight(std::numeric_limits<double>::quiet_NaN(),0.0) ); }
     58};
    4659
    4760
     
    105118  }
    106119
     120  std::transform(m.begin(), m.end(), m.begin(), CleanUpMatrix());
    107121  std::vector<double> target;
    108122  ( assay.present() ?
Note: See TracChangeset for help on using the changeset viewer.