Changeset 819


Ignore:
Timestamp:
Nov 24, 2008, 10:56:17 AM (13 years ago)
Author:
Jari Häkkinen
Message:

Changed u_int to unsigned int to make code pass compilation on my Mac OS X 10.5

Location:
plugins/base1/se.lu.thep.wenni/trunk/lib/c++_tools
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • plugins/base1/se.lu.thep.wenni/trunk/lib/c++_tools/gslapi/matrix.cc

    r110 r819  
    6868    // expandable)
    6969    std::vector<std::vector<double> > data_matrix;
    70     u_int nof_columns=0;
    71     u_int nof_rows = 0;
     70    unsigned int nof_columns=0;
     71    unsigned int nof_rows = 0;
    7272    std::string line;
    7373    while(getline(is, line, '\n')){
     
    120120    // convert the data to a gsl matrix
    121121    m_ = gsl_matrix_alloc ( nof_rows, nof_columns );
    122     for(u_int i=0;i<nof_rows;i++)
    123       for(u_int j=0;j<nof_columns;j++)
     122    for(unsigned int i=0;i<nof_rows;i++)
     123      for(unsigned int j=0;j<nof_columns;j++)
    124124        gsl_matrix_set( m_, i, j, data_matrix[i][j] );
    125125  }
  • plugins/base1/se.lu.thep.wenni/trunk/lib/c++_tools/gslapi/vector.cc

    r597 r819  
    9898    // expandable)
    9999    std::vector<std::vector<double> > data_matrix;
    100     u_int nof_columns=0;
    101     u_int nof_rows=0;
     100    unsigned int nof_columns=0;
     101    unsigned int nof_rows=0;
    102102    std::string line;
    103103    while(getline(is, line, '\n')) {
  • plugins/base1/se.lu.thep.wenni/trunk/lib/c++_tools/utility/FileIO.cc

    r95 r819  
    4242    }
    4343    int mode=0;
    44     for (u_int i=0; i<bits.length(); i++)
     44    for (unsigned int i=0; i<bits.length(); i++)
    4545      switch (bits[i]) {
    4646          case 'r':
  • plugins/base1/se.lu.thep.wenni/trunk/lib/c++_tools/utility/NNI.cc

    r95 r819  
    4343  // documentation.
    4444  NNI::NNI(const gslapi::matrix& matrix,const gslapi::matrix& weight,
    45            const u_int neighbours)
     45           const unsigned int neighbours)
    4646    : data_(matrix), imputed_data_(matrix), neighbours_(neighbours),
    4747      weight_(weight)
     
    5353  //                {\sum_{k=l,C} w_{ik} w_{jk} }
    5454  // where C is the number of columns
    55   vector<pair<u_int,double> > NNI::calculate_distances(const u_int row) const
     55  vector<pair<unsigned int,double> > NNI::calculate_distances(const unsigned int row) const
    5656  {
    57     vector<pair<u_int,double> > distance;
     57    vector<pair<unsigned int,double> > distance;
    5858    for (size_t i=0; i<data_.rows(); i++)
    5959      if (i!=row) {
    6060        double contribs=0;
    61         pair<u_int,double> this_distance(i,0.0);
     61        pair<unsigned int,double> this_distance(i,0.0);
    6262        for (size_t j=0; j<data_.columns(); j++)
    6363          // 0 contribution for missing values
     
    8282  // number, and neighbours are disqualified if their element (column)
    8383  // weight is zero
    84   vector<u_int>
    85   NNI::nearest_neighbours(const u_int column,
    86                           const vector<pair<u_int,double> >& d) const
     84  vector<unsigned int>
     85  NNI::nearest_neighbours(const unsigned int column,
     86                          const vector<pair<unsigned int,double> >& d) const
    8787  {
    88     vector<u_int> index;
     88    vector<unsigned int> index;
    8989    double contribs=0;
    90     for (u_int i=0; ((i<d.size()) &&
     90    for (unsigned int i=0; ((i<d.size()) &&
    9191                     (contribs+=weight_(d[i].first,column))<=neighbours_); i++)
    9292      if (weight_(d[i].first,column))
  • plugins/base1/se.lu.thep.wenni/trunk/lib/c++_tools/utility/NNI.h

    r95 r819  
    8989    ///
    9090    NNI(const gslapi::matrix& matrix,const gslapi::matrix& weight,
    91         const u_int neighbours);
     91        const unsigned int neighbours);
    9292
    9393    virtual ~NNI(void) {};
     
    9898    /// @return number of rows not imputed
    9999    ///
    100     virtual u_int estimate(void)=0;
     100    virtual unsigned int estimate(void)=0;
    101101
    102102    ///
     
    111111
    112112  protected:
    113     std::vector<std::pair<u_int,double> > calculate_distances(const u_int) const;
    114     std::vector<u_int> nearest_neighbours(const u_int,
    115                              const std::vector<std::pair<u_int,double> >&) const;
     113    std::vector<std::pair<unsigned int,double> > calculate_distances(const unsigned int) const;
     114    std::vector<unsigned int> nearest_neighbours(const unsigned int,
     115                             const std::vector<std::pair<unsigned int,double> >&) const;
    116116
    117117    const gslapi::matrix& data_;
    118118    gslapi::matrix imputed_data_;
    119     u_int neighbours_;
     119    unsigned int neighbours_;
    120120    std::vector<size_t> not_imputed_;
    121121    const gslapi::matrix& weight_;
  • plugins/base1/se.lu.thep.wenni/trunk/lib/c++_tools/utility/WeNNI.cc

    r95 r819  
    3838
    3939  WeNNI::WeNNI(const gslapi::matrix& matrix,const gslapi::matrix& flag,
    40                const u_int neighbours)
     40               const unsigned int neighbours)
    4141    : NNI(matrix,flag,neighbours), imputed_data_raw_(matrix)
    4242  {
     
    5050  // where N is defined in the paper cited in the NNI class definition
    5151  // documentation.
    52   u_int WeNNI::estimate(void)
     52  unsigned int WeNNI::estimate(void)
    5353  {
    5454    using namespace std;
    5555    for (unsigned int i=0; i<data_.rows(); i++) {
    5656      // Jari, avoid copying in next line
    57       vector<pair<u_int,double> > distance=calculate_distances(i);
     57      vector<pair<unsigned int,double> > distance=calculate_distances(i);
    5858      sort(distance.begin(),distance.end(),
    59                 pair_value_compare<u_int,double>());
     59                pair_value_compare<unsigned int,double>());
    6060      bool row_imputed=true;
    6161      for (unsigned int j=0; j<data_.columns(); j++) {
    62         vector<u_int> knn=nearest_neighbours(j,distance);
     62        vector<unsigned int> knn=nearest_neighbours(j,distance);
    6363        double new_value=0.0;
    6464        double norm=0.0;
    65         for (vector<u_int>::const_iterator k=knn.begin(); k!=knn.end(); k++) {
     65        for (vector<unsigned int>::const_iterator k=knn.begin(); k!=knn.end(); k++) {
    6666          // Jari, a small number needed here, use something standardized.
    6767          // Avoid division with zero (perfect match vectors)
  • plugins/base1/se.lu.thep.wenni/trunk/lib/c++_tools/utility/WeNNI.h

    r95 r819  
    5555    ///
    5656    WeNNI(const gslapi::matrix& matrix,const gslapi::matrix& weight,
    57           const u_int neighbours);
     57          const unsigned int neighbours);
    5858
    5959    ///
     
    6262    /// value.
    6363    ///
    64     u_int estimate(void);
     64    unsigned int estimate(void);
    6565
    6666    ///
  • plugins/base1/se.lu.thep.wenni/trunk/lib/c++_tools/utility/kNNI.cc

    r95 r819  
    3838
    3939  kNNI::kNNI(const gslapi::matrix& matrix,const gslapi::matrix& flag,
    40              const u_int neighbours)
     40             const unsigned int neighbours)
    4141    : NNI(matrix,flag,neighbours)
    4242  {
     
    5656  // where N is defined in the paper cited in the NNI class definition
    5757  // documentation.
    58   u_int kNNI::estimate(void)
     58  unsigned int kNNI::estimate(void)
    5959  {
    6060    using namespace std;
    6161    for (unsigned int i=0; i<mv_rows_.size(); i++) {
    6262      // Jari, avoid copying in next line
    63       vector<pair<u_int,double> > distance=calculate_distances(mv_rows_[i]);
     63      vector<pair<unsigned int,double> > distance=calculate_distances(mv_rows_[i]);
    6464      sort(distance.begin(),distance.end(),
    65                 pair_value_compare<u_int,double>());
     65                pair_value_compare<unsigned int,double>());
    6666      for (unsigned int j=0; j<data_.columns(); j++)
    6767        if (!weight_(mv_rows_[i],j)) {
    68           vector<u_int> knn=nearest_neighbours(j,distance);
     68          vector<unsigned int> knn=nearest_neighbours(j,distance);
    6969          double new_value=0.0;
    7070          double norm=0.0;
    71           for (vector<u_int>::const_iterator k=knn.begin(); k!=knn.end(); k++){
     71          for (vector<unsigned int>::const_iterator k=knn.begin(); k!=knn.end(); k++){
    7272            // Jari, a small number needed here, use something standardized.
    7373            // Avoid division with zero (perfect match vectors)
  • plugins/base1/se.lu.thep.wenni/trunk/lib/c++_tools/utility/kNNI.h

    r95 r819  
    5353    ///
    5454    kNNI(const gslapi::matrix& matrix,const gslapi::matrix& weight,
    55          const u_int neighbours);
     55         const unsigned int neighbours);
    5656
    5757    ///
     
    6060    /// value.
    6161    ///
    62     u_int estimate(void);
     62    unsigned int estimate(void);
    6363
    6464  private:
    65     std::vector<u_int> mv_rows_;  // index to rows that have values to estimate
     65    std::vector<unsigned int> mv_rows_; // index to rows that have values to estimate
    6666  };
    6767
Note: See TracChangeset for help on using the changeset viewer.