Changeset 1271


Ignore:
Timestamp:
Apr 9, 2008, 6:11:07 PM (15 years ago)
Author:
Peter
Message:

replaced u_int with unsigned int or size_t

Location:
trunk/yat
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/IGP.h

    r1158 r1271  
    116116    igp_ = utility::Vector(target_.nof_classes());
    117117   
    118     for(u_int i=0; i<target_.size(); i++) {
    119       u_int neighbor=i;
     118    for(size_t i=0; i<target_.size(); i++) {
     119      size_t neighbor=i;
    120120      double mindist=std::numeric_limits<double>::max();
    121121      const DataLookup1D a(matrix_,i,false);
    122       for(u_int j=0; j<target_.size(); j++) {           
     122      for(size_t j=0; j<target_.size(); j++) {           
    123123        DataLookup1D b(matrix_,j,false);
    124124        double dist=distance_(a.begin, a.end(), b.begin());
     
    132132     
    133133    }
    134     for(u_int i=0; i<target_.nof_classes(); i++) {
     134    for(size_t i=0; i<target_.nof_classes(); i++) {
    135135      igp_(i)/=static_cast<double>(target_.size(i));
    136136    }
  • trunk/yat/classifier/KNN.h

    r1189 r1271  
    9696       \return The number of neighbors.
    9797    */
    98     u_int k() const;
     98    unsigned int k() const;
    9999
    100100    /**
     
    103103       Sets the number of neighbors to \a k_in.
    104104    */
    105     void k(u_int k_in);
     105    void k(unsigned int k_in);
    106106
    107107
     
    166166
    167167    // The number of neighbors
    168     u_int k_;
     168    unsigned int k_;
    169169
    170170    Distance distance_;
     
    240240 
    241241  template <typename Distance, typename NeighborWeighting>
    242   u_int KNN<Distance, NeighborWeighting>::k() const
     242  unsigned int KNN<Distance, NeighborWeighting>::k() const
    243243  {
    244244    return k_;
     
    246246
    247247  template <typename Distance, typename NeighborWeighting>
    248   void KNN<Distance, NeighborWeighting>::k(u_int k)
     248  void KNN<Distance, NeighborWeighting>::k(unsigned k)
    249249  {
    250250    k_=k;
  • trunk/yat/classifier/Kernel.cc

    r1168 r1271  
    4242  {
    4343    if (own)
    44       ref_count_ = new u_int(1);
     44      ref_count_ = new unsigned int(1);
    4545    else
    4646      ref_count_ = NULL;
     
    5353  {
    5454    if (own){
    55       ref_count_w_ = new u_int(1);
     55      ref_count_w_ = new unsigned int(1);
    5656    }
    5757    else {
     
    6868    if (other.weighted()){
    6969      mlw_ = new MatrixLookupWeighted(*other.mlw_, utility::Index(index),true);
    70       ref_count_w_ = new u_int(1);
     70      ref_count_w_ = new unsigned int(1);
    7171      ml_=NULL;
    7272      ref_count_ = NULL;
     
    7474    else{
    7575      ml_ = new MatrixLookup(*other.ml_, utility::Index(index),true);
    76       ref_count_ = new u_int(1);
     76      ref_count_ = new unsigned int(1);
    7777      mlw_=NULL;
    7878      ref_count_w_ = NULL;
  • trunk/yat/classifier/Kernel.h

    r1260 r1271  
    3030#include "KernelFunction.h"
    3131
    32 #include <cctype>
     32#include <cstddef>
    3333#include <vector>
    34 
    35 #include <sys/types.h>
    3634
    3735namespace theplu {
     
    183181    /// (data_). NULL if this is not an owner.
    184182    ///
    185     u_int* ref_count_;
     183    unsigned int* ref_count_;
    186184
    187185    ///
     
    189187    /// (data_w_). NULL if this is not an owner.
    190188    ///
    191     u_int* ref_count_w_;
     189    unsigned int* ref_count_w_;
    192190
    193191  private:
  • trunk/yat/classifier/SupervisedClassifier.h

    r1188 r1271  
    2727*/
    2828
    29 #include <stddef.h>
     29#include <cstddef>
    3030
    3131namespace theplu {
  • trunk/yat/classifier/utility.cc

    r1120 r1271  
    3636  {
    3737    vector = utility::Vector(lookup.size());
    38     for(u_int i=0; i<lookup.size(); i++)
     38    for(size_t i=0; i<lookup.size(); i++)
    3939      vector(i)=lookup(i);
    4040  }
     
    4646    value = utility::Vector(lookup.size());
    4747    weight = utility::Vector(lookup.size());
    48     for(u_int i=0; i<lookup.size(); i++){
     48    for(size_t i=0; i<lookup.size(); i++){
    4949      value(i)=lookup.data(i);
    5050      weight(i)=lookup.weight(i);
  • trunk/yat/random/random.cc

    r1000 r1271  
    6161
    6262
    63   u_long RNG::max(void) const
     63  unsigned long RNG::max(void) const
    6464  {
    6565    return gsl_rng_max(rng_);
     
    6767
    6868
    69   u_long RNG::min(void) const
     69  unsigned long RNG::min(void) const
    7070  {
    7171    return gsl_rng_min(rng_);
     
    8585
    8686
    87   void RNG::seed(u_long s) const
     87  void RNG::seed(unsigned long s) const
    8888  {
    8989    gsl_rng_set(rng_,s);
     
    9191
    9292
    93   u_long RNG::seed_from_devurandom(void)
    94   {
    95     u_char ulongsize=sizeof(u_long);
     93  unsigned long RNG::seed_from_devurandom(void)
     94  {
     95    unsigned char ulongsize=sizeof(unsigned long);
    9696    char* buffer=new char[ulongsize];
    9797    std::ifstream is("/dev/urandom");
    9898    is.read(buffer,ulongsize);
    9999    is.close();
    100     u_long s=0;
    101     for (u_int i=0; i<ulongsize; i++) {
    102       u_char ch=buffer[i];
     100    unsigned long s=0;
     101    for (unsigned int i=0; i<ulongsize; i++) {
     102      unsigned char ch=buffer[i];
    103103      s+=ch<<((ulongsize-1-i)*8);
    104104    }
     
    146146
    147147
    148   void Discrete::seed(u_long s) const
     148  void Discrete::seed(unsigned long s) const
    149149  {
    150150    rng_->seed(s);
     151  }
     152
     153
     154  unsigned long Discrete::seed_from_devurandom(void)
     155  {
     156    return rng_->seed_from_devurandom();
    151157  }
    152158
     
    172178
    173179
    174   u_long DiscreteGeneral::operator()(void) const
     180  unsigned long DiscreteGeneral::operator()(void) const
    175181  {
    176182    return gsl_ran_discrete(rng_->rng(), gen_);
     
    178184
    179185
    180   DiscreteUniform::DiscreteUniform(u_long n)
     186  DiscreteUniform::DiscreteUniform(unsigned long n)
    181187    : range_(n)
    182188  {
     
    189195
    190196
    191   u_long DiscreteUniform::operator()(void) const
     197  unsigned long DiscreteUniform::operator()(void) const
    192198  {
    193199    return (range_ ?
     
    196202
    197203
    198   u_long DiscreteUniform::operator()(u_long n) const
     204  unsigned long DiscreteUniform::operator()(unsigned long n) const
    199205  {
    200206    // making sure that n is not larger than the range of the
    201207    // underlying RNG
    202208    if (n>rng_->max()) {
    203       std::stringstream ss("DiscreteUniform::operator(u_long): ");
     209      std::stringstream ss("DiscreteUniform::operator(unsigned long): ");
    204210      ss << n << " is too large for RNG " << rng_->name();
    205211      throw utility::GSL_error(ss.str());
     
    214220  }
    215221
    216   u_long Poisson::operator()(void) const
     222  unsigned long Poisson::operator()(void) const
    217223  {
    218224    return gsl_ran_poisson(rng_->rng(), m_);
     
    220226
    221227
    222   u_long Poisson::operator()(const double m) const
     228  unsigned long Poisson::operator()(const double m) const
    223229  {
    224230    return gsl_ran_poisson(rng_->rng(), m);
     
    238244
    239245
    240   void Continuous::seed(u_long s) const
     246  void Continuous::seed(unsigned long s) const
    241247  {
    242248    rng_->seed(s);
  • trunk/yat/random/random.h

    r1004 r1271  
    9898    /// generator can return.
    9999    ///
    100     u_long max(void) const;
     100    unsigned long max(void) const;
    101101
    102102    ///
     
    104104    /// generator can return.
    105105    ///
    106     u_long min(void) const;
     106    unsigned long min(void) const;
    107107
    108108    ///
     
    125125    /// @see seed_from_devurandom
    126126    ///
    127     void seed(u_long s) const;
     127    void seed(unsigned long s) const;
    128128
    129129    ///
     
    132132    /// @return The seed acquired from /dev/urandom.
    133133    ///
    134     u_long seed_from_devurandom(void);
     134    unsigned long seed_from_devurandom(void);
    135135
    136136    /**
     
    221221    /// @see seed_from_devurandom, RNG::seed_from_devurandom, RNG::seed
    222222    ///
    223     void seed(u_long s) const;
     223    void seed(unsigned long s) const;
    224224
    225225    ///
     
    230230    /// @see seed, RNG::seed_from_devurandom, RNG::seed
    231231    ///
    232     u_long seed_from_devurandom(void) { return rng_->seed_from_devurandom(); }
     232    unsigned long seed_from_devurandom(void);
    233233
    234234    ///
    235235    /// @return A random number.
    236236    ///
    237     virtual u_long operator()(void) const = 0;
     237    virtual unsigned long operator()(void) const = 0;
    238238   
    239239  protected:
     
    268268    /// @return A random number.
    269269    ///
    270     u_long operator()(void) const;
     270    unsigned long operator()(void) const;
    271271
    272272  private:
     
    302302       is thrown.
    303303    */
    304     DiscreteUniform(u_long n=0);
     304    DiscreteUniform(unsigned long n=0);
    305305
    306306    /**
     
    311311       created.
    312312
    313        \see DiscreteUniform(const u_long n=0)
     313       \see DiscreteUniform(const unsigned long n=0)
    314314    */
    315     u_long operator()(void) const;
     315    unsigned long operator()(void) const;
    316316
    317317    /**
     
    325325       underlying generator.
    326326    */
    327     u_long operator()(u_long n) const;
    328 
    329   private:
    330     u_long range_;
     327    unsigned long operator()(unsigned long n) const;
     328
     329  private:
     330    unsigned long range_;
    331331  };
    332332
     
    359359    /// @return A Poisson distributed number.
    360360    ///
    361     u_long operator()(void) const;
     361    unsigned long operator()(void) const;
    362362
    363363    ///
     
    367367    /// @note this operator ignores parameters set in Constructor
    368368    ///
    369     u_long operator()(const double m) const;
     369    unsigned long operator()(const double m) const;
    370370
    371371  private:
     
    403403    /// @see seed_from_devurandom, RNG::seed_from_devurandom, RNG::seed
    404404    ///
    405     void seed(u_long s) const;
     405    void seed(unsigned long s) const;
    406406
    407407    ///
     
    412412    /// @see seed, RNG::seed_from_devurandom, RNG::seed
    413413    ///
    414     u_long seed_from_devurandom(void) { return rng_->seed_from_devurandom(); }
     414    unsigned long seed_from_devurandom(void) { return rng_->seed_from_devurandom(); }
    415415
    416416    ///
  • trunk/yat/regression/OneDimensional.cc

    r1000 r1271  
    5353
    5454  std::ostream& OneDimensional::print(std::ostream& os, const double min,
    55                                       double max, const u_int n) const
     55                                      double max, const unsigned int n) const
    5656  {
    5757    double dx;
  • trunk/yat/regression/OneDimensional.h

    r1019 r1271  
    106106    ///
    107107    std::ostream& print(std::ostream& os,const double min,
    108                         double max, const u_int n) const;
     108                        double max, const unsigned int n) const;
    109109
    110110    /**
  • trunk/yat/regression/Polynomial.cc

    r1121 r1271  
    5555    utility::Matrix X=utility::Matrix(x.size(),power_+1,1);
    5656    for (size_t i=0; i<X.rows(); ++i)
    57       for (u_int j=1; j<X.columns(); j++)
     57      for (size_t j=1; j<X.columns(); ++j)
    5858        X(i,j)=X(i,j-1)*x(i);
    5959    md_.fit(X,y);
  • trunk/yat/regression/PolynomialWeighted.cc

    r1121 r1271  
    5656    utility::Matrix X=utility::Matrix(x.size(),power_+1,1);
    5757    for (size_t i=0; i<X.rows(); ++i)
    58       for (u_int j=1; j<X.columns(); j++)
     58      for (size_t j=1; j<X.columns(); ++j)
    5959        X(i,j)=X(i,j-1)*x(i);
    6060    md_.fit(X,y,w);
  • trunk/yat/statistics/Averager.cc

    r1122 r1271  
    3737  }
    3838
    39   Averager::Averager(double x, double xx, u_long n)
     39  Averager::Averager(double x, double xx, unsigned long n)
    4040    : n_(n), x_(x), xx_(xx)
    4141  {
     
    4747  }
    4848
    49   void Averager::add(double d, u_long n)
     49  void Averager::add(double d, unsigned long n)
    5050  {
    5151    assert(!std::isnan(d));
     
    6565  }
    6666
    67   u_long Averager::n(void) const
     67  unsigned long Averager::n(void) const
    6868  {
    6969    return n_;
  • trunk/yat/statistics/Averager.h

    r1186 r1271  
    3030
    3131#include <cmath>
    32 #include <sys/types.h>
    3332
    3433namespace theplu{
     
    5655    /// number of samples \a n.
    5756    ///
    58     Averager(double x, double xx, u_long n);
     57    Averager(double x, double xx, unsigned long n);
    5958
    6059    ///
     
    6665    /// Adding \a n (default=1) number of data point(s) with value \a d.
    6766    ///
    68     void add(double d, u_long n=1);
     67    void add(double d, unsigned long n=1);
    6968
    7069    /**
     
    8685    /// @return Number of data points
    8786    ///
    88     u_long n(void) const;
     87    unsigned long n(void) const;
    8988
    9089    ///
     
    179178
    180179  private:
    181     u_long  n_;
     180    unsigned long n_;
    182181    double  x_, xx_;
    183182  };
  • trunk/yat/statistics/Fisher.cc

    r1000 r1271  
    7272
    7373
    74   u_int& Fisher::minimum_size(void)
     74  unsigned int& Fisher::minimum_size(void)
    7575  {
    7676    return minimum_size_;
     
    7878
    7979
    80   const u_int& Fisher::minimum_size(void) const
     80  const unsigned int& Fisher::minimum_size(void) const
    8181  {
    8282    return minimum_size_;
     
    8484
    8585
    86   double Fisher::oddsratio(const u_int a,
    87                            const u_int b,
    88                            const u_int c,
    89                            const u_int d)
     86  double Fisher::oddsratio(const unsigned int a,
     87                           const unsigned int b,
     88                           const unsigned int c,
     89                           const unsigned int d)
    9090  {
    9191    // If a column sum or a row sum is zero, the table is nonsense
  • trunk/yat/statistics/Fisher.h

    r1000 r1271  
    2828
    2929#include "Score.h"
    30 
    31 #include <sys/types.h>
    3230
    3331#include <cmath>
     
    106104    /// @return reference to minimum_size
    107105    ///
    108     u_int& minimum_size(void);
     106    unsigned int& minimum_size(void);
    109107
    110108    ///
     
    114112    /// @return const reference to minimum_size
    115113    ///
    116     const u_int& minimum_size(void) const;
     114    const unsigned int& minimum_size(void) const;
    117115
    118116    ///
     
    150148       is invalid if a row or column sum is zero.
    151149    */
    152     double oddsratio(const u_int a, const u_int b,
    153                      const u_int c, const u_int d);
     150    double oddsratio(const unsigned a, const unsigned int b,
     151                     const unsigned int c, const unsigned int d);
    154152
    155153  private:
     
    161159    double p_value_exact(void) const;
    162160
    163     u_int a_;
    164     u_int b_;
    165     u_int c_;
    166     u_int d_;
    167     u_int minimum_size_;
     161    unsigned int a_;
     162    unsigned int b_;
     163    unsigned int c_;
     164    unsigned int d_;
     165    unsigned int minimum_size_;
    168166    double oddsratio_;
    169167  };
  • trunk/yat/statistics/Histogram.cc

    r1203 r1271  
    118118  void Histogram::reset(void)
    119119  {
    120     for (u_int i=0; i<histogram_.size(); i++)
     120    for (size_t i=0; i<histogram_.size(); i++)
    121121      histogram_[i]=0;
    122122    sum_all_.reset();
     
    174174      << "# column 2: frequency\n";
    175175
    176     for (u_int i=0; i<histogram.nof_bins(); i++) {
     176    for (size_t i=0; i<histogram.nof_bins(); i++) {
    177177      s.width(12);
    178178      s << histogram.observation_value(i);
  • trunk/yat/statistics/PearsonCorrelation.cc

    r1145 r1271  
    4242  {
    4343    return pearson_p_value(ap_.correlation(),
    44                            static_cast<u_int>(ap_.n()));
     44                           static_cast<unsigned int>(ap_.n()));
    4545  }
    4646
  • trunk/yat/statistics/PearsonCorrelation.h

    r1145 r1271  
    7070       
    7171       P-value is calculated using function pearson_p_value(double,
    72        u_int) where degrees of freedom is calculated using n(void) in
     72       unsigned int) where degrees of freedom is calculated using n(void) in
    7373       AveragerPairWeighted.
    7474
  • trunk/yat/statistics/ROC.cc

    r1120 r1271  
    103103  }
    104104
    105   u_int& ROC::minimum_size(void)
     105  unsigned int& ROC::minimum_size(void)
    106106  {
    107107    return minimum_size_;
     
    109109
    110110
    111   const u_int& ROC::minimum_size(void) const
     111  const unsigned int& ROC::minimum_size(void) const
    112112  {
    113113    return minimum_size_;
  • trunk/yat/statistics/ROC.h

    r1260 r1271  
    3232#include <map>
    3333#include <utility>
    34 
    35 #include <sys/types.h>
    3634
    3735namespace theplu {
     
    8078    /// @return reference to minimum_size
    8179    ///
    82     u_int& minimum_size(void);
     80    unsigned int& minimum_size(void);
    8381
    8482    /**
     
    8886       @return const reference to minimum_size
    8987    */
    90     const u_int& minimum_size(void) const;
     88    const unsigned int& minimum_size(void) const;
    9189
    9290    ///
     
    144142
    145143    double area_;
    146     u_int minimum_size_;
     144    unsigned int minimum_size_;
    147145    double w_neg_;
    148146    double w_pos_;
  • trunk/yat/statistics/utility.cc

    r1145 r1271  
    3737namespace statistics { 
    3838
    39   double cdf_hypergeometric_P(u_int k, u_int n1, u_int n2, u_int t)
     39  double cdf_hypergeometric_P(unsigned int k, unsigned int n1,
     40                              unsigned int n2, unsigned int t)
    4041  {
    4142    double p=0;
    42     for (u_int i=0; i<=k; i++)
     43    for (size_t i=0; i<=k; i++)
    4344      p+= gsl_ran_hypergeometric_pdf(i, n1, n2, t);
    4445    return p;
     
    4647
    4748
    48   double pearson_p_value(double r, u_int n)
     49  double pearson_p_value(double r, unsigned int n)
    4950  {
    5051    assert(n>=2);
    51     if (n<2)
     52    if (n<=2)
    5253      return std::numeric_limits<double>::quiet_NaN();
    5354    return gsl_cdf_tdist_Q(r*sqrt((n-2)/(1-r*r)), n-2);
  • trunk/yat/statistics/utility.h

    r1145 r1271  
    7777  /// @return cumulative hypergeomtric distribution functions P(k).
    7878  ///
    79   double cdf_hypergeometric_P(u_int k, u_int n1, u_int n2, u_int t);
     79  double cdf_hypergeometric_P(unsigned int k, unsigned int n1,
     80                              unsigned int n2, unsigned int t);
    8081
    8182
     
    9394     chance when having \a n samples.
    9495   */
    95   double pearson_p_value(double r, u_int n);
     96  double pearson_p_value(double r, unsigned int n);
    9697
    9798  ///
  • trunk/yat/utility/Matrix.cc

    r1260 r1271  
    3737#include <vector>
    3838
    39 #include <sys/types.h>
    40 
    4139#include <gsl/gsl_blas.h>
    4240
     
    7876    // expandable)
    7977    std::vector<std::vector<double> > data_matrix;
    80     u_int nof_columns=0;
    81     u_int nof_rows = 0;
     78    unsigned int nof_columns=0;
     79    unsigned int nof_rows = 0;
    8280    std::string line;
    8381    while(getline(is, line, '\n')){
     
    140138    // if gsl error handler disabled, out of bounds index will not
    141139    // abort the program.
    142     for(u_int i=0;i<nof_rows;i++)
    143       for(u_int j=0;j<nof_columns;j++)
     140    for(size_t i=0;i<nof_rows;i++)
     141      for(size_t j=0;j<nof_columns;j++)
    144142        gsl_matrix_set( m_, i, j, data_matrix[i][j] );
    145143  }
  • trunk/yat/utility/NNI.cc

    r1121 r1271  
    3939  // documentation.
    4040  NNI::NNI(const utility::Matrix& matrix,const utility::Matrix& weight,
    41            const u_int neighbours)
     41           const unsigned int neighbours)
    4242    : data_(matrix), imputed_data_(matrix), neighbours_(neighbours),
    4343      weight_(weight)
     
    4949  //                {\sum_{k=l,C} w_{ik} w_{jk} }
    5050  // where C is the number of columns
    51   std::vector<std::pair<u_int,double> >
    52   NNI::calculate_distances(const u_int row) const
     51  std::vector<std::pair<size_t,double> >
     52  NNI::calculate_distances(const size_t row) const
    5353  {
    54     std::vector<std::pair<u_int,double> > distance;
     54    std::vector<std::pair<size_t,double> > distance;
    5555    for (size_t i=0; i<data_.rows(); i++)
    5656      if (i!=row) {
    5757        double contribs=0;
    58         std::pair<u_int,double> this_distance(i,0.0);
     58        std::pair<size_t,double> this_distance(i,0.0);
    5959        for (size_t j=0; j<data_.columns(); j++)
    6060          // 0 contribution for missing values
     
    9090  // number, and neighbours are disqualified if their element (column)
    9191  // weight is zero
    92   std::vector<u_int>
    93   NNI::nearest_neighbours(const u_int column,
    94                           const std::vector<std::pair<u_int,double> >& d) const
     92  std::vector<size_t>
     93  NNI::nearest_neighbours(const size_t column,
     94                          const std::vector<std::pair<size_t,double> >& d) const
    9595  {
    96     std::vector<u_int> index;
     96    std::vector<size_t> index;
    9797    double contribs=0;
    98     for (u_int i=0; ((i<d.size()) &&
     98    for (size_t i=0; ((i<d.size()) &&
    9999                     (contribs+=weight_(d[i].first,column))<=neighbours_); i++)
    100100      if (weight_(d[i].first,column))
  • trunk/yat/utility/NNI.h

    r1260 r1271  
    3333#include <utility>
    3434#include <vector>
    35 
    36 #include <sys/types.h>
    3735
    3836namespace theplu {
     
    9290    ///
    9391    NNI(const utility::Matrix& matrix,const utility::Matrix& weight,
    94         const u_int neighbours);
     92        const unsigned int neighbours);
    9593
    9694    virtual ~NNI(void) {};
     
    10199    /// @return number of rows not imputed
    102100    ///
    103     virtual u_int estimate(void)=0;
     101    virtual unsigned int estimate(void)=0;
    104102
    105103    ///
     
    118116       }{\sum_{k=l}^C w_{ik} w_{jk} } \f$ where C is the number of columns
    119117    */
    120     std::vector<std::pair<u_int,double> > calculate_distances(const u_int) const;
     118    std::vector<std::pair<size_t,double> >
     119    calculate_distances(const size_t) const;
    121120    /// Contributing nearest neighbours are added up to the user set
    122121    /// number, and neighbours are disqualified if their element
    123122    /// (column) weight is zero
    124     std::vector<u_int> nearest_neighbours(const u_int,
    125                              const std::vector<std::pair<u_int,double> >&) const;
     123    std::vector<size_t>
     124    nearest_neighbours(const size_t,
     125                       const std::vector<std::pair<size_t,double> >&) const;
    126126    ///
    127127    /// original data matrix
     
    137137    /// number of neighbor to use
    138138    ///
    139     u_int neighbours_;
     139    unsigned int neighbours_;
    140140
    141141    ///
  • trunk/yat/utility/SmartPtr.h

    r1260 r1271  
    2626
    2727#include "yat_assert.h"
    28 
    29 // debug
    30 #include <iostream>
    31 
    32 #include <sys/types.h>
    3328
    3429namespace theplu {
     
    7469    {
    7570      if (owner)
    76         ref_count_ = new u_int(1);
     71        ref_count_ = new unsigned int(1);
    7772      else
    7873        ref_count_ = NULL;
     
    134129  private:
    135130    T* pointee_;
    136     u_int* ref_count_;
     131    unsigned int* ref_count_;
    137132
    138133    void detach(void)
  • trunk/yat/utility/Vector.cc

    r1268 r1271  
    2727#include "Vector.h"
    2828#include "utility.h"
    29 #include "yat/random/random.h"
    3029
    3130#include <algorithm>
     
    8079    // expandable)
    8180    std::vector<std::vector<double> > data_matrix;
    82     u_int nof_columns=0;
    83     u_int nof_rows=0;
     81    unsigned int nof_columns=0;
     82    unsigned int nof_rows=0;
    8483    std::string line;
    8584    while(getline(is, line, '\n')) {
  • trunk/yat/utility/WeNNI.cc

    r1121 r1271  
    3838
    3939  WeNNI::WeNNI(const utility::Matrix& matrix,const utility::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  {
    54     for (unsigned int i=0; i<data_.rows(); i++) {
    55       std::vector<std::pair<u_int,double> > distance(calculate_distances(i));
     54    for (size_t i=0; i<data_.rows(); i++) {
     55      std::vector<std::pair<size_t,double> > distance(calculate_distances(i));
    5656      std::sort(distance.begin(),distance.end(),
    57                 pair_value_compare<u_int,double>());
     57                pair_value_compare<size_t,double>());
    5858      bool row_imputed=true;
    59       for (unsigned int j=0; j<data_.columns(); j++) {
    60         std::vector<u_int> knn=nearest_neighbours(j,distance);
     59      for (size_t j=0; j<data_.columns(); j++) {
     60        std::vector<size_t> knn=nearest_neighbours(j,distance);
    6161        double new_value=0.0;
    6262        double norm=0.0;
    63         for (std::vector<u_int>::const_iterator k=knn.begin(); k!=knn.end();
     63        for (std::vector<size_t>::const_iterator k=knn.begin(); k!=knn.end();
    6464             ++k) {
    6565          // Avoid division with zero (perfect match vectors)
  • trunk/yat/utility/WeNNI.h

    r1121 r1271  
    5555    ///
    5656    WeNNI(const utility::Matrix& matrix,const utility::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    ///
  • trunk/yat/utility/kNNI.cc

    r1121 r1271  
    3737
    3838  kNNI::kNNI(const utility::Matrix& matrix,const utility::Matrix& flag,
    39              const u_int neighbours)
     39             const unsigned int neighbours)
    4040    : NNI(matrix,flag,neighbours)
    4141  {
     
    5555  // where N is defined in the paper cited in the NNI class definition
    5656  // documentation.
    57   u_int kNNI::estimate(void)
     57  unsigned int kNNI::estimate(void)
    5858  {
    59     for (unsigned int i=0; i<mv_rows_.size(); i++) {
    60       std::vector<std::pair<u_int,double> >
     59    for (size_t i=0; i<mv_rows_.size(); i++) {
     60      std::vector<std::pair<size_t,double> >
    6161        distance(calculate_distances(mv_rows_[i]));
    6262      std::sort(distance.begin(),distance.end(),
    63                 pair_value_compare<u_int,double>());
    64       for (unsigned int j=0; j<data_.columns(); j++)
     63                pair_value_compare<size_t,double>());
     64      for (size_t j=0; j<data_.columns(); j++)
    6565        if (!weight_(mv_rows_[i],j)) {
    66           std::vector<u_int> knn=nearest_neighbours(j,distance);
     66          std::vector<size_t> knn=nearest_neighbours(j,distance);
    6767          double new_value=0.0;
    6868          double norm=0.0;
    69           for (std::vector<u_int>::const_iterator k=knn.begin(); k!=knn.end();
     69          for (std::vector<size_t>::const_iterator k=knn.begin(); k!=knn.end();
    7070               ++k) {
    7171            // Avoid division with zero (perfect match vectors)
  • trunk/yat/utility/kNNI.h

    r1121 r1271  
    5656    ///
    5757    kNNI(const utility::Matrix& matrix,const utility::Matrix& weight,
    58          const u_int neighbours);
     58         const unsigned int neighbours);
    5959
    6060    ///
     
    6363    /// value.
    6464    ///
    65     u_int estimate(void);
     65    unsigned int estimate(void);
    6666
    6767  private:
    68     std::vector<u_int> mv_rows_;  // index to rows that have values to estimate
     68    std::vector<size_t> mv_rows_; // index to rows that have values to estimate
    6969  };
    7070
Note: See TracChangeset for help on using the changeset viewer.