Changeset 703


Ignore:
Timestamp:
Dec 18, 2006, 1:47:44 AM (15 years ago)
Author:
Jari Häkkinen
Message:

Addresses #65 and #170.

Location:
trunk/yat
Files:
53 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/regression/Linear.cc

    r698 r703  
    3232namespace regression {
    3333
     34  Linear::Linear(void)
     35    : OneDimensional(), alpha_(0), alpha_var_(0), beta_(0), beta_var_(0),
     36      mse_(0), m_x_(0)
     37  {
     38  }
     39
     40  Linear::~Linear(void)
     41  {
     42  }
     43         
    3444  void Linear::fit(const utility::vector& x, const utility::vector& y)
    3545  {
     
    5565  }
    5666
    57 
    5867  double Linear::standard_error(const double x) const
    5968  {
  • trunk/yat/regression/Linear.h

    r702 r703  
    4646  public:
    4747    ///
    48     /// Default Constructor.
     48    /// @brief The default constructor
    4949    ///
    50     inline Linear(void)
    51       : OneDimensional(), alpha_(0), alpha_var_(0), beta_(0), beta_var_(0),
    52         mse_(0), m_x_(0){}
     50    Linear(void);
    5351
    5452    ///
    55     /// Destructor
     53    /// @brief The destructor
    5654    ///
    57     inline virtual ~Linear(void) {};
     55    virtual ~Linear(void);
    5856         
    5957    ///
  • trunk/yat/regression/LinearWeighted.cc

    r702 r703  
    3232namespace regression {
    3333
     34  LinearWeighted::LinearWeighted(void)
     35    : OneDimensionalWeighted(), alpha_(0), alpha_var_(0), beta_(0),
     36      beta_var_(0), m_x_(0), s2_(0)
     37  {
     38  }
     39
     40  LinearWeighted::~LinearWeighted(void)
     41  {
     42  }
     43
    3444  void LinearWeighted::fit(const utility::vector& x,
    3545                           const utility::vector& y,
  • trunk/yat/regression/LinearWeighted.h

    r702 r703  
    4646  public:
    4747    ///
    48     /// Default Constructor.
     48    /// @brief The default constructor.
    4949    ///
    50     inline LinearWeighted(void)
    51       : OneDimensionalWeighted(), alpha_(0), alpha_var_(0), beta_(0),
    52         beta_var_(0),
    53         m_x_(0), s2_(0) {}
     50    LinearWeighted(void);
    5451
    5552    ///
    56     /// Destructor
     53    /// @brief The destructor
    5754    ///
    58     inline virtual ~LinearWeighted(void) {};
     55    virtual ~LinearWeighted(void);
    5956         
    6057    ///
  • trunk/yat/regression/Local.cc

    r682 r703  
    3434namespace yat {
    3535namespace regression {
     36
     37  Local::Local(OneDimensionalWeighted& r, Kernel& k)
     38    : kernel_(&k), regressor_(&r)
     39  {
     40  }
     41
     42  Local::~Local(void)
     43  {
     44  }
    3645
    3746  void Local::fit(const size_t step_size, const size_t nof_points)
  • trunk/yat/regression/Local.h

    r682 r703  
    5151  public:
    5252    ///
    53     /// Constructor taking type of \a regressor,
     53    /// @brief Constructor taking type of \a regressor,
    5454    /// type of \a kernel.
    5555    ///
    56     inline Local(OneDimensionalWeighted& r, Kernel& k)
    57       : kernel_(&k), regressor_(&r) {}
     56    Local(OneDimensionalWeighted& r, Kernel& k);
    5857
    5958    ///
    60     /// Destructor
     59    /// @brief The destructor
    6160    ///
    62     virtual ~Local(void) {};
    63 
     61    virtual ~Local(void);
    6462
    6563    ///
  • trunk/yat/regression/MultiDimensional.cc

    r682 r703  
    2929namespace yat {
    3030namespace regression {
     31
     32
     33  MultiDimensional::MultiDimensional(void)
     34    : chisquare_(0), work_(NULL)
     35  {
     36  }
     37
     38
     39  MultiDimensional::~MultiDimensional(void)
     40  {
     41    if (work_)
     42      gsl_multifit_linear_free(work_);
     43  }
    3144
    3245
  • trunk/yat/regression/MultiDimensional.h

    r682 r703  
    4444    /// @brief Default Constructor
    4545    ///
    46     inline MultiDimensional(void) : chisquare_(0), work_(NULL) {}
     46    MultiDimensional(void);
    4747
    4848    ///
    4949    /// @brief Destructor
    5050    ///
    51     inline ~MultiDimensional(void) { if (work_) gsl_multifit_linear_free(work_);}
     51    ~MultiDimensional(void);
    5252
    5353    ///
  • trunk/yat/regression/MultiDimensionalWeighted.cc

    r682 r703  
    3131namespace yat {
    3232namespace regression {
     33
     34  MultiDimensionalWeighted::MultiDimensionalWeighted(void)
     35    : chisquare_(0), work_(NULL)
     36  {
     37  }
     38
     39  MultiDimensionalWeighted::~MultiDimensionalWeighted(void)
     40  {
     41    if (work_)
     42      gsl_multifit_linear_free(work_);
     43  }
    3344
    3445  void MultiDimensionalWeighted::fit(const utility::matrix& x,
  • trunk/yat/regression/MultiDimensionalWeighted.h

    r682 r703  
    4444    /// @brief Default Constructor
    4545    ///
    46     inline MultiDimensionalWeighted(void) : chisquare_(0), work_(NULL) {}
     46    MultiDimensionalWeighted(void);
    4747
    4848    ///
    4949    /// @brief Destructor
    5050    ///
    51     inline ~MultiDimensionalWeighted(void)
    52     { if (work_) gsl_multifit_linear_free(work_);}
     51    ~MultiDimensionalWeighted(void);
    5352
    5453    ///
  • trunk/yat/regression/Naive.cc

    r702 r703  
    3535namespace regression {
    3636
     37  Naive::Naive(void)
     38    : OneDimensional(), mse_(0.0)
     39  {
     40  }
     41
     42  Naive::~Naive(void)
     43  {
     44  }
     45
    3746  void Naive::fit(const utility::vector& x, const utility::vector& y)
    3847  {
  • trunk/yat/regression/Naive.h

    r702 r703  
    4747  public:
    4848    ///
    49     /// Default Constructor.
     49    /// @brief The default constructor
    5050    ///
    51     inline Naive(void) : OneDimensional(), mse_(0.0) {}
     51    Naive(void);
    5252
    5353    ///
    54     /// Copy Constructor. (not implemented)
     54    /// @brief The destructor
    5555    ///
    56     Naive(const Naive&);
    57 
    58     ///
    59     /// Destructor
    60     ///
    61     virtual ~Naive(void) {};
     56    virtual ~Naive(void);
    6257         
    6358    ///
     
    8580
    8681  private:
     82    ///
     83    /// @brief The copy constructor (not implemented).
     84    ///
     85    Naive(const Naive&);
     86
    8787    double mse_;
    8888  };
  • trunk/yat/regression/NaiveWeighted.cc

    r702 r703  
    3333namespace regression {
    3434
     35  NaiveWeighted::NaiveWeighted(void)
     36    : OneDimensionalWeighted()
     37  {
     38  }
     39
     40  NaiveWeighted::~NaiveWeighted(void)
     41  {
     42  }
     43
    3544  void NaiveWeighted::fit(const utility::vector& x,
    3645                          const utility::vector& y,
  • trunk/yat/regression/NaiveWeighted.h

    r702 r703  
    4848  public:
    4949    ///
    50     /// Default Constructor.
     50    /// @brief The default constructor
    5151    ///
    52     inline NaiveWeighted(void)
    53       : OneDimensionalWeighted() {}
     52    NaiveWeighted(void);
    5453
    5554    ///
    56     /// Destructor
     55    /// @brief The destructor
    5756    ///
    58     virtual ~NaiveWeighted(void) {};
     57    virtual ~NaiveWeighted(void);
    5958         
    6059    /**
  • trunk/yat/regression/OneDimensional.cc

    r682 r703  
    2828namespace regression {
    2929
     30  OneDimensional::OneDimensional(void)
     31  {
     32  }
     33
     34  OneDimensional::~OneDimensional(void)
     35  {
     36  }
     37
    3038  std::ostream& OneDimensional::print(std::ostream& os, const double min,
    3139                                      double max, const u_int n) const
  • trunk/yat/regression/OneDimensional.h

    r702 r703  
    4646  public:
    4747    ///
    48     /// Default Constructor.
     48    /// @brief The default constructor
    4949    ///
    50     inline OneDimensional(void) {}
     50    OneDimensional(void);
    5151
    5252    ///
    53     /// Destructor
     53    /// @brief The destructor
    5454    ///
    55     virtual ~OneDimensional(void) {};
     55    virtual ~OneDimensional(void);
    5656         
    5757    /**
  • trunk/yat/regression/Polynomial.cc

    r697 r703  
    3030namespace regression {
    3131
     32  Polynomial::Polynomial(size_t power)
     33    : OneDimensional(), mse_(0), power_(power)
     34  {
     35  }
     36
     37  Polynomial::~Polynomial(void)
     38  {
     39  }
     40
    3241  void Polynomial::fit(const utility::vector& x, const utility::vector& y)
    3342  {
  • trunk/yat/regression/Polynomial.h

    r702 r703  
    4747    /// @param power degree of polynomial, e.g. 1 for a linear model
    4848    ///
    49     inline Polynomial(size_t power)
    50       : OneDimensional(), mse_(0), power_(power) {}
     49    explicit Polynomial(size_t power);
    5150
    5251    ///
    5352    /// @brief Destructor
    5453    ///
    55     inline ~Polynomial(void) {};
     54    ~Polynomial(void);
    5655
    5756    ///
  • trunk/yat/regression/PolynomialWeighted.cc

    r682 r703  
    3131namespace yat {
    3232namespace regression {
     33
     34  PolynomialWeighted::PolynomialWeighted(size_t power)
     35    : OneDimensionalWeighted(), mse_(0), power_(power)
     36  {
     37  }
     38
     39  PolynomialWeighted::~PolynomialWeighted(void)
     40  {
     41  }
    3342
    3443  void PolynomialWeighted::fit(const utility::vector& x,
  • trunk/yat/regression/PolynomialWeighted.h

    r702 r703  
    4545    /// @param power degree of polynomial model
    4646    ///
    47     inline PolynomialWeighted(size_t power)
    48       : OneDimensionalWeighted(), mse_(0), power_(power) {}
     47    PolynomialWeighted(size_t power);
    4948
    5049    ///
    5150    /// @brief Destructor
    5251    ///
    53     inline ~PolynomialWeighted(void) {};
     52    ~PolynomialWeighted(void);
    5453
    5554    ///
  • trunk/yat/statistics/Averager.cc

    r680 r703  
    4343  }
    4444
     45  void Averager::add(double d, u_long n)
     46  {
     47    n_  += n;
     48    x_  += n*d;
     49    xx_ += n*d*d;
     50  }
     51
     52  void Averager::rescale(double a)
     53  {
     54    x_  *= a;
     55    xx_ *= a*a;
     56  }
     57
     58  void Averager::reset(void)
     59  {
     60    n_=0;
     61    x_=xx_=0.0;
     62  }
     63
     64  const Averager& Averager::operator=(const Averager& a)
     65  {
     66    n_  = a.n_;
     67    x_  = a.x_;
     68    xx_ = a.xx_;
     69    return *this;
     70  }
     71
    4572  const Averager& Averager::operator+=(const Averager& a)
    4673  {
  • trunk/yat/statistics/Averager.h

    r680 r703  
    6262    /// Adding \a n (default=1) number of data point(s) with value \a d.
    6363    ///
    64     inline void add(double d, u_long n=1) { n_+=n; x_+=n*d; xx_+=n*d*d;}
     64    void add(double d, u_long n=1);
    6565
    6666    ///
     
    9595
    9696    ///
    97     /// Rescales the object, \f$ \forall x_i \rightarrow a*x_i \f$,
     97    /// @brief Rescales the object
     98    ///
     99    /// \f$ \forall x_i \rightarrow a*x_i \f$,
    98100    /// \f$ \forall x_i^2 \rightarrow a^2*x_i^2 \f$
    99101    ///
    100     inline void rescale(double a) { x_*=a; xx_*=a*a; }
     102    inline void rescale(double a);
    101103
    102104    ///
     
    107109
    108110    ///
    109     /// The standard deviation is defined as the square root of the
    110     /// variance.
     111    /// @brief The standard deviation is defined as the square root of
     112    /// the variance.
    111113    ///
    112114    /// @return The standard deviation, root of the variance().
     
    115117
    116118    ///
    117     /// The standard deviation is defined as the square root of the
    118     /// variance.
     119    /// @brief The standard deviation is defined as the square root of
     120    /// the variance.
    119121    ///
    120122    /// @return Standard deviation around \a m, root of the variance(m).
     
    138140
    139141    ///
     142    /// @brief The variance with know mean
     143    ///
     144    /// The variance is calculated as
    140145    /// \f$ \frac{1}{n}\sum (x_i-m)^2 \f$.
    141146    ///
     
    146151
    147152    ///
     153    /// @brief The estimated variance
     154    ///
    148155    /// The variance is calculated as \f$ \frac{1}{N}\sum_i
    149156    /// (x_i-m)^2 \f$, where \f$ m \f$ is the mean.
    150157    ///
    151     /// @return estimation of variance
     158    /// @return Estimation of variance
    152159    ///
    153160    inline double variance(void) const
     
    166173
    167174    ///
    168     /// Resets everything to zero
    169     ///
    170     inline void reset(void) { n_=0; x_=xx_=0.0;}
    171 
    172     ///
    173     /// The assignment operator
    174     ///
    175     inline const Averager& operator=(const Averager& a)
    176       { n_=a.n_; x_=a.x_; xx_=a.xx_; return *this; }
     175    /// @brief Reset everything to zero
     176    ///
     177    void reset(void);
     178
     179    ///
     180    /// @brief The assignment operator
     181    ///
     182    const Averager& operator=(const Averager&);
    177183
    178184    ///
  • trunk/yat/statistics/AveragerPair.cc

    r683 r703  
    3131namespace yat {
    3232namespace statistics {
    33  
     33
     34  AveragerPair::AveragerPair(void)
     35    : x_(Averager()), y_(Averager()), xy_(0.0)
     36  {
     37  }
     38
     39  AveragerPair::AveragerPair(const AveragerPair& a)
     40    : x_(a.x_averager()), y_(a.y_averager()), xy_(a.sum_xy())
     41  {
     42  }
     43
     44  void AveragerPair::add(const double x, const double y, const unsigned long n)
     45  {
     46    x_.add(x,n); y_.add(y,n); xy_ += n*x*y;
     47  }
     48
     49  void AveragerPair::reset(void)
     50  {
     51    x_.reset(); y_.reset(); xy_=0.0;
     52  }
     53
     54  const AveragerPair& AveragerPair::operator=(const AveragerPair& a)
     55  {
     56    x_=a.x_; y_=a.y_; xy_=a.xy_;
     57    return *this;
     58  }
     59
    3460  const AveragerPair& AveragerPair::operator+=(const AveragerPair& a)
    3561  {
  • trunk/yat/statistics/AveragerPair.h

    r680 r703  
    4545
    4646    ///
    47     /// Default constructor
     47    /// @brief The default constructor
    4848    ///
    49     inline AveragerPair(void) : x_(Averager()), y_(Averager()), xy_(0.0) {}
    50    
     49    AveragerPair(void);
     50
    5151    ///
    5252    /// Constructor taking sum of \a x , \a xx , \a y , \a yy , xy and
     
    5858
    5959    ///
    60     /// Copy constructor
     60    /// The copy constructor
    6161    ///
    62     inline AveragerPair(const AveragerPair& a)
    63       : x_(a.x_averager()), y_(a.y_averager()), xy_(a.sum_xy()) {}
    64    
     62    AveragerPair(const AveragerPair&);
     63
    6564    ///
    6665    /// Adding \a n pairs of data points with value \a x and \a y.
    6766    ///
    68     inline void add(const double x, const double y, const unsigned long n=1)
    69       { x_.add(x,n); y_.add(y,n), xy_ += n*x*y; }
     67    void add(const double x, const double y, const unsigned long n=1);
    7068
    7169    ///
     
    131129
    132130    ///
    133     /// Resets everything to zero
     131    /// @brief Reset everything to zero
    134132    ///
    135     inline void reset(void) { x_.reset(); y_.reset(); xy_=0.0; }
     133    void reset(void);
    136134
    137135    ///
     
    156154
    157155    ///
    158     /// The assigment operator
     156    /// @brief The assigment operator
    159157    ///
    160     inline const AveragerPair& operator=(const AveragerPair& a)
    161       { x_=a.x_; y_=a.y_; xy_=a.xy_; return *this; }
     158    const AveragerPair& operator=(const AveragerPair& a);
    162159
    163160    ///
  • trunk/yat/statistics/AveragerPairWeighted.cc

    r701 r703  
    3131namespace yat {
    3232namespace statistics {
    33  
     33
     34
     35  AveragerPairWeighted::AveragerPairWeighted(void)
     36    : wxy_(0), w_(0)
     37  {
     38  }
     39
    3440
    3541  void  AveragerPairWeighted::add(const double x, const double y,
     
    6470  }
    6571
     72
     73  void AveragerPairWeighted::reset(void)
     74  {
     75    x_.reset(); y_.reset(); wxy_=0; w_=0;
     76  }
     77
    6678}}} // of namespace statistics, yat, and theplu
  • trunk/yat/statistics/AveragerPairWeighted.h

    r683 r703  
    5555  public:
    5656
    57     AveragerPairWeighted()
    58       : wxy_(0), w_(0)
    59     {
    60     }
     57    ///
     58    /// @brief The default constructor
     59    ///
     60    AveragerPairWeighted(void);
    6161
    6262    ///
     
    122122
    123123    ///
    124     /// reset everything to zero
     124    /// @brief Reset everything to zero
    125125    ///
    126     inline void reset(void) { x_.reset(); y_.reset(); wxy_=0; w_=0; }
     126    void reset(void);
    127127
    128128    ///
  • trunk/yat/statistics/AveragerWeighted.cc

    r683 r703  
    2828namespace statistics {
    2929
    30   AveragerWeighted AveragerWeighted::operator+=(const AveragerWeighted& a)
     30  AveragerWeighted::AveragerWeighted(void)
     31    : w_(Averager()), wx_(Averager()), wwx_(0), wxx_(0)
     32  {
     33  }
     34
     35  AveragerWeighted::AveragerWeighted(const AveragerWeighted& a)
     36    : w_(Averager(a.sum_w(),a.sum_ww(),1)),
     37      wx_(Averager(a.sum_wx(),a.sum_wwxx(),1)),
     38      wwx_(a.sum_wwx()),
     39      wxx_(a.sum_wxx())
     40  {
     41  }
     42
     43  void AveragerWeighted::add(const double d, const double w)
     44  {
     45    if (!w)
     46      return;
     47    w_.add(w); wx_.add(w*d); wwx_+=w*w*d; wxx_+=w*d*d;
     48  }
     49
     50  void AveragerWeighted::rescale(double a)
     51  {
     52    wx_.rescale(a);
     53    wwx_*=a;
     54    wxx_*=a*a;
     55  }
     56
     57  void AveragerWeighted::reset(void)
     58  {
     59    wx_.reset(); w_.reset(); wwx_=0; wxx_=0;
     60  }
     61
     62  const AveragerWeighted& AveragerWeighted::operator+=(const AveragerWeighted& a)
    3163  {
    3264    wx_+=a.wx(); w_+=a.w(); wwx_+=a.sum_wwx(); wxx_+=a.sum_wxx();
  • trunk/yat/statistics/AveragerWeighted.h

    r699 r703  
    6565
    6666    ///
    67     /// Default constructor
     67    /// @brief The default constructor
    6868    ///
    69     inline AveragerWeighted(void)
    70       : w_(Averager()), wx_(Averager()), wwx_(0), wxx_(0) {}
    71 
    72     ///
    73     /// Copy constructor
    74     ///
    75     inline AveragerWeighted(const AveragerWeighted& a)
    76       : w_(Averager(a.sum_w(),a.sum_ww(),1)),
    77         wx_(Averager(a.sum_wx(),a.sum_wwxx(),1)), wwx_(a.sum_wwx()),
    78         wxx_(a.sum_wxx()) {}
    79 
    80     ///
    81     /// adding a data point d, with weight w (default is 1)
    82     ///
    83     inline void add(const double d,const double w=1)
    84     { if(w==0) return; w_.add(w); wx_.add(w*d); wwx_+=w*w*d; wxx_+=w*d*d; }
     69    AveragerWeighted(void);
     70
     71    ///
     72    /// @brief The copy constructor
     73    ///
     74    AveragerWeighted(const AveragerWeighted&);
     75
     76    ///
     77    /// Adding a data point \a d, with weight \a w (default is 1)
     78    ///
     79    void  add(const double d,const double w=1);
    8580
    8681    ///
     
    9691
    9792    ///
    98     /// Calculating the weighted mean
     93    /// @brief Calculate the weighted mean
    9994    ///
    10095    /// @return \f$ \frac{\sum w_ix_i}{\sum w_i} \f$
    10196    ///
    102     inline double mean(void) const { return sum_w() ?
    103                                        sum_wx()/sum_w() : 0; }
     97    inline double mean(void) const { return sum_w() ? sum_wx()/sum_w() : 0; }
    10498
    10599    ///
     
    117111
    118112    ///
    119     /// rescale object, i.e. each data point is rescaled
    120     /// \f$ x = a * x \f$
    121     ///
    122     inline void rescale(double a) { wx_.rescale(a); wwx_*=a; wxx_*=a*a; }
    123 
    124     ///
    125     /// resets everything to zero
    126     ///
    127     inline void reset(void) { wx_.reset(); w_.reset(); wwx_=0; wxx_=0; }
    128 
    129     ///
    130     /// The standard deviation is defined as the square root of the
    131     /// variance().
     113    /// @brief Rescale object.
     114    ///
     115    /// Each data point is rescaled as \f$ x = a * x \f$
     116    ///
     117    void rescale(double a);
     118
     119    ///
     120    /// @brief Reset everything to zero.
     121    ///
     122    void reset(void);
     123
     124    ///
     125    /// @brief The standard deviation is defined as the square root of
     126    /// the variance().
    132127    ///
    133128    /// @return The standard deviation, root of the variance().
     
    136131
    137132    ///
    138     /// Calculates standard deviation of the mean(). Variance from the
     133    /// @brief Calculates standard deviation of the mean().
     134    ///
     135    /// Variance from the
    139136    /// weights are here neglected. This is true when the weight is
    140137    /// known before the measurement. In case this is not a good
     
    219216    /// operator to add a AveragerWeighted
    220217    ///
    221     AveragerWeighted operator+=(const AveragerWeighted&);
     218    const AveragerWeighted& operator+=(const AveragerWeighted&);
    222219   
    223220    Averager w_;
     
    226223    double wxx_;
    227224   
    228     inline Averager wx(void) const {return wx_;}
    229     inline Averager w(void) const {return w_;}
    230 
    231 
     225    inline Averager wx(void) const { return wx_; }
     226    inline Averager w(void) const { return w_; }
    232227  };
    233228
  • trunk/yat/statistics/Distance.cc

    r683 r703  
    3131namespace statistics{
    3232
    33   double Distance::operator()(const classifier::DataLookup1D& x,
     33  Distance::Distance(void)
     34  {
     35  }
     36
     37  Distance::~Distance(void)
     38  {
     39  }
     40
     41  double Distance::operator()(const classifier::DataLookup1D& x,
    3442                              const classifier::DataLookup1D& y) const
    3543  {
  • trunk/yat/statistics/Distance.h

    r683 r703  
    4444  public:
    4545
    46     Distance()
    47     {
    48     }
     46    ///
     47    /// @brief The default constructor
     48    ///
     49    Distance(void);
    4950
    50     virtual ~Distance()
    51     {
    52     }
     51    ///
     52    /// @brief The destructor
     53    ///
     54    virtual ~Distance(void);
    5355
    5456    ///
  • trunk/yat/statistics/Pearson.cc

    r683 r703  
    3838  Pearson::Pearson(bool b)
    3939    : Score(b), r_(0), nof_samples_(0)
     40  {
     41  }
     42
     43  Pearson::~Pearson(void)
    4044  {
    4145  }
  • trunk/yat/statistics/Pearson.h

    r683 r703  
    4343  class Pearson : public Score
    4444  {
    45  
    4645  public:
    4746    ///
    48     /// Default Constructor.
     47    /// @brief The default constructor.
    4948    ///
    5049    Pearson(bool absolute=true);
    5150
    5251    ///
    53     /// Destructor
     52    /// @brief The destructor.
    5453    ///
    55     virtual ~Pearson(void) {};
     54    virtual ~Pearson(void);
    5655         
    5756   
  • trunk/yat/statistics/PearsonDistance.cc

    r683 r703  
    3131namespace statistics{
    3232
     33  PearsonDistance::PearsonDistance(void)
     34    : Distance()
     35  {
     36  }
     37
     38  PearsonDistance::~PearsonDistance(void)
     39  {
     40  }
     41
    3342  double PearsonDistance::operator()(const utility::vector& x,
    3443                                     const utility::vector& y) const
  • trunk/yat/statistics/PearsonDistance.h

    r683 r703  
    4747  public:
    4848
    49     PearsonDistance()
    50       : Distance()
    51     {
    52     }
     49    PearsonDistance(void);
    5350
    54     virtual ~PearsonDistance()
    55     {
    56     }   
    57    
     51    virtual ~PearsonDistance(void);
     52
    5853    // Use all operator() from Distance except the ones that are
    5954    // overloaded in this class.
     
    6863                              const utility::vector& wx,
    6964                              const utility::vector& wy) const;
    70 
    71   private:
    7265  };
    7366
  • trunk/yat/statistics/ROC.cc

    r683 r703  
    3939  ROC::ROC(bool b)
    4040    : Score(b), area_(0.5), minimum_size_(10), nof_pos_(0) 
     41  {
     42  }
     43
     44  ROC::~ROC(void)
    4145  {
    4246  }
  • trunk/yat/statistics/ROC.h

    r683 r703  
    5050  public:
    5151    ///
    52     /// Default constructor
     52    /// @brief Default constructor
    5353    ///
    5454    ROC(bool absolute=true);
    5555         
    5656    ///
    57     /// Destructor
     57    /// @brief The destructor
    5858    ///
    59     virtual ~ROC(void) {};
     59    virtual ~ROC(void);
    6060         
    6161    /// Function taking \a value, \a target (+1 or -1) and vector
  • trunk/yat/statistics/SNR.h

    r683 r703  
    5454  public:
    5555    ///
    56     /// Default Constructor.
     56    /// @brief Default Constructor.
    5757    ///
    5858    SNR(bool absolute=true);
  • trunk/yat/statistics/Score.cc

    r683 r703  
    3333  }
    3434
     35  Score::~Score(void)
     36  {
     37  }
     38
     39  double Score::score(const classifier::Target& target,
     40                      const classifier::DataLookup1D& value)
     41  {
     42    assert(target.size()==value.size());
     43    utility::vector a;
     44    classifier::convert(value,a);
     45    return score(target,a);
     46  }
     47
     48  double Score::score(const classifier::Target& target,
     49                      const classifier::DataLookup1D& value,
     50                      const classifier::DataLookup1D& weight)
     51  {
     52    utility::vector a;
     53    classifier::convert(value,a);
     54    utility::vector b;
     55    classifier::convert(weight,a);
     56    return score(target,a,b);
     57  }
     58
    3559}}} // of namespace statistics, yat, and theplu
  • trunk/yat/statistics/Score.h

    r683 r703  
    5252  public:
    5353    ///
    54     ///   Constructor
     54    /// @brief Constructor
    5555    ///   
    5656    Score(bool absolute=true) ;
    5757   
    5858    ///
    59     ///   Destructor
     59    /// @brief Destructor
    6060    ///
    61     virtual ~Score(void) {};
     61    virtual ~Score(void);
    6262   
    6363    ///
    64     /// Function changing mode of Score
     64    /// @brief Function changing mode of Score
    6565    ///
    6666    inline void absolute(bool absolute) {absolute_=absolute;}
     
    8787    /// @param value vector of the values
    8888    ///
    89     inline double
    90     score(const classifier::Target& target,
    91           const classifier::DataLookup1D& value)
    92     {
    93       assert(target.size()==value.size());
    94       utility::vector a;
    95       classifier::convert(value,a);
    96       return score(target,a);
    97     }
     89    double score(const classifier::Target& target,
     90                 const classifier::DataLookup1D& value);
    9891 
    9992    ///
     
    127120    /// is wanted.
    128121    ///
    129     inline double
    130     score(const classifier::Target& target,
    131           const classifier::DataLookup1D& value,
    132           const classifier::DataLookup1D& weight)
    133     {
    134       utility::vector a;
    135       classifier::convert(value,a);
    136       utility::vector b;
    137       classifier::convert(weight,a);
    138       return score(target,a,b);
    139     }
     122    double score(const classifier::Target& target,
     123                 const classifier::DataLookup1D& value,
     124                 const classifier::DataLookup1D& weight);
    140125
    141126  protected:
  • trunk/yat/statistics/tScore.h

    r683 r703  
    4848  public:
    4949    ///
    50     /// Default Constructor.
     50    /// 2brief Default Constructor.
    5151    ///
    5252    tScore(bool absolute=true);
  • trunk/yat/statistics/utility.cc

    r683 r703  
    3737      p+= gsl_ran_hypergeometric_pdf(i, n1, n2, t);
    3838    return p;
     39  }
     40
     41  double kurtosis(const utility::vector& v)
     42  {
     43    const gsl_vector* gvp=v.gsl_vector_p();
     44    return gsl_stats_kurtosis(gvp->data,gvp->stride,gvp->size);
    3945  }
    4046
     
    8288  }
    8389
     90  double skewness(const utility::vector& v)
     91  {
     92    const gsl_vector* gvp=v.gsl_vector_p();
     93    return gsl_stats_skew(gvp->data,gvp->stride,gvp->size);
     94  }
     95
    8496}}} // of namespace statistics, yat, and theplu
  • trunk/yat/statistics/utility.h

    r683 r703  
    4040  //forward declarations
    4141  template <class T>
    42   inline double median(const std::vector<T>& v, const bool sorted=false);
     42  double median(const std::vector<T>& v, const bool sorted=false);
    4343
    4444  template <class T>
     
    6161
    6262  ///
    63   /// Computes the kurtosis of the data in a vector. The kurtosis
    64   /// measures how sharply peaked a distribution is, relative to its
    65   /// width. The kurtosis is normalized to zero for a gaussian
    66   /// distribution.
     63  /// @brief Computes the kurtosis of the data in a vector.
    6764  ///
    68   inline double kurtosis(const utility::vector& v)
    69   {
    70     const gsl_vector* gvp=v.gsl_vector_p();
    71     return gsl_stats_kurtosis(gvp->data,gvp->stride,gvp->size);
    72   }
     65  /// The kurtosis measures how sharply peaked a distribution is,
     66  /// relative to its width. The kurtosis is normalized to zero for a
     67  /// gaussian distribution.
     68  ///
     69  double kurtosis(const utility::vector&);
    7370
    7471
     
    173170
    174171  ///
    175   /// Computes the skewness of the data in a vector. The skewness
    176   /// measures the asymmetry of the tails of a distribution.
     172  /// @brief Computes the skewness of the data in a vector.
    177173  ///
    178   inline double skewness(const utility::vector& v)
    179   {
    180     const gsl_vector* gvp=v.gsl_vector_p();
    181     return gsl_stats_skew(gvp->data,gvp->stride,gvp->size);
    182   }
     174  /// The skewness measures the asymmetry of the tails of a
     175  /// distribution.
     176  ///
     177  double skewness(const utility::vector&);
    183178 
    184179}}} // of namespace statistics, yat, and theplu
  • trunk/yat/utility/CommandLine.h

    r687 r703  
    148148
    149149    ///
    150     /// If more than maximal number of arguments is found during
    151     /// parsing an error message is displayed followed by exit.
     150    /// @brief If more than maximal number of arguments is found
     151    /// during parsing an error message is displayed followed by exit.
    152152    ///
    153153    /// @return maximal number of arguments allowed.
     
    156156
    157157    ///
    158     /// If less than minimal number of arguments is found during
    159     /// parsing an error message is displayed followed by exit.
     158    /// @brief If less than minimal number of arguments is found
     159    /// during parsing an error message is displayed followed by exit.
    160160    ///
    161161    /// @return minimal number of arguments allowed.
     
    181181
    182182    ///
    183     /// The @a description will be included in help display giving a
    184     /// general explanation what program is doing.
     183    /// @brief The @a description will be included in help display
     184    /// giving a general explanation what program is doing.
    185185    ///
    186186    inline void set_general_description(const std::string& description)
  • trunk/yat/utility/PCA.cc

    r687 r703  
    3232namespace yat {
    3333namespace utility {
     34
     35
     36  PCA::PCA(const utility::matrix& A)
     37    : A_(A), process_(false), explained_calc_(false)
     38  {
     39  }
    3440
    3541
  • trunk/yat/utility/PCA.h

    r687 r703  
    4747  public:
    4848    /**
    49        Default constructor (not implemented)
    50     */
    51     PCA(void);
    52 
    53     /**
    5449       Constructor taking the data-matrix as input. No row-centering
    5550       should have been performed and no products.
    5651     */
    57     inline explicit PCA(const utility::matrix& A)
    58       : A_(A), process_(false), explained_calc_(false) {}
    59 
     52    explicit PCA(const utility::matrix&);
     53 
    6054    /**
    6155       Will perform PCA according to the following scheme: \n
     
    8074       @return Eigenvector \a i.
    8175    */
    82     inline utility::vector get_eigenvector(const size_t& i) const
     76    inline utility::vector get_eigenvector(size_t i) const
    8377      { return utility::vector(eigenvectors_,i); }
    8478
     
    8781       \f$ C = \frac{1}{N^2}A^TA \f$
    8882    */
    89     inline double
    90     get_eigenvalue(const size_t& i) const { return eigenvalues_[i]; }
     83    inline double get_eigenvalue(size_t i) const { return eigenvalues_[i]; }
    9184
    9285    /**
  • trunk/yat/utility/SVD.cc

    r687 r703  
    2727namespace yat {
    2828namespace utility {
     29
     30
     31  SVD::SVD(const utility::matrix& Ain)
     32    : U_(Ain), V_(Ain.columns(),Ain.columns()), s_(Ain.columns())
     33  {
     34  }
     35
     36
     37  SVD::~SVD(void)
     38  {
     39  }
    2940
    3041
  • trunk/yat/utility/SVD.h

    r687 r703  
    7171
    7272    ///
    73     /// Constructs an SVD object using the matrix A as only input. The
     73    /// Constructs an SVD object using the matrix Ain as only input. The
    7474    /// input matrix is copied for further use in the object.
    7575    ///
    76     inline SVD(const utility::matrix& Ain)
    77       : U_(Ain), V_(Ain.columns(),Ain.columns()), s_(Ain.columns()) {}
     76    SVD(const utility::matrix& Ain);
    7877
    79     inline ~SVD(void) {}
     78    ///
     79    /// @brief The destructor
     80    ///
     81    ~SVD(void);
    8082
    8183    ///
     
    8890
    8991    ///
    90     /// Access to the s vector.
     92    /// @brief Access to the s vector.
    9193    ///
    9294    /// @return A copy of the s vector.
     
    98100
    99101    ///
    100     /// Solve the system \f$ Ax=b \f$ using the decomposition of A.
     102    /// @brief Solve the system \f$ Ax=b \f$ using the decomposition
     103    /// of A.
    101104    ///
    102105    /// @note If decompose() has not been run the outcome of the call
     
    111114
    112115    ///
    113     /// Access to the U matrix.
     116    /// @brief Access to the U matrix.
    114117    ///
    115118    /// @return A copy of the U matrix.
     
    121124
    122125    ///
    123     /// Access to the V matrix.
     126    /// @brief Access to the V matrix.
    124127    ///
    125128    /// @return A copy of the V matrix.
  • trunk/yat/utility/WeNNI.h

    r687 r703  
    6868
    6969
    70 
    7170  private:
    7271
  • trunk/yat/utility/matrix.cc

    r680 r703  
    3939namespace utility {
    4040
     41
     42  matrix::matrix(void)
     43    : m_(NULL), view_(NULL)
     44  {
     45  }
     46
     47
     48  matrix::matrix(const size_t& r, const size_t& c, double init_value)
     49    : view_(NULL)
     50  {
     51    m_ = gsl_matrix_alloc(r,c);
     52    set_all(init_value);
     53  }
     54
     55
     56  matrix::matrix(const matrix& o)
     57    : view_(NULL)
     58  {
     59    m_ = o.create_gsl_matrix_copy();
     60  }
    4161
    4262
     
    212232
    213233
     234  const matrix& matrix::operator+=(const matrix& m)
     235  {
     236    add(m);
     237    return *this;
     238  }
     239
     240
     241  const matrix& matrix::operator+=(const double d)
     242  {
     243    add_constant(d);
     244    return *this;
     245  }
     246
     247
     248  const matrix& matrix::operator-=(const matrix& m)
     249  {
     250    sub(m);
     251    return *this;
     252  }
     253
    214254
    215255  const matrix& matrix::operator*=(const matrix& other)
     
    222262  }
    223263
     264
     265  const matrix& matrix::operator*=(const double d)
     266  {
     267    scale(d);
     268    return *this;
     269  }
    224270
    225271
  • trunk/yat/utility/matrix.h

    r687 r703  
    8080       structures.
    8181    */
    82     inline matrix(void) : m_(NULL), view_(NULL) {}
    83 
    84     ///
    85     /// Constructor. Allocates memory space for \a r times \a c
     82    matrix(void);
     83
     84    ///
     85    /// @brief Constructor allocating memory space for \a r times \a c
    8686    /// elements, and sets all elements to \a init_value.
    8787    ///
    88     inline matrix(const size_t& r, const size_t& c, double init_value=0)
    89       : view_(NULL) { m_ = gsl_matrix_alloc(r,c); set_all(init_value); }
    90 
    91     ///
    92     /// The copy constructor.
     88    matrix(const size_t& r, const size_t& c, double init_value=0);
     89
     90    ///
     91    /// @brief The copy constructor.
    9392    ///
    9493    /// @note If the object to be copied is a matrix view, the values
    9594    /// of the view will be copied, i.e. the view is not copied.
    9695    ///
    97     inline matrix(const matrix& o) : view_(NULL) {m_=o.create_gsl_matrix_copy();}
     96    matrix(const matrix&);
    9897
    9998    ///
     
    134133
    135134    ///
    136     /// The destructor.
     135    /// @brief The destructor.
    137136    ///
    138137    ~matrix(void);
     
    199198
    200199    ///
    201     /// Check if the matrix object is a view (sub-matrix) to another
    202     /// matrix.
     200    /// @brief Check if the matrix object is a view (sub-matrix) to
     201    /// another matrix.
    203202    ///
    204203    /// @return True if the object is a view, false othwerwise.
     
    216215    /// row-major order).
    217216    ///
    218     inline std::pair<size_t,size_t> max_index(void) const;
     217    std::pair<size_t,size_t> max_index(void) const;
    219218
    220219    ///
     
    228227    /// row-major order).
    229228    ///
    230     inline std::pair<size_t,size_t> min_index(void) const;
     229    std::pair<size_t,size_t> min_index(void) const;
    231230
    232231    ///
     
    308307
    309308    ///
    310     /// Set \a row values to values in \a vec.
     309    /// @brief Set \a row values to values in \a vec.
    311310    ///
    312311    /// @return Whatever GSL returns.
     
    335334
    336335    ///
    337     /// Swap columns \a i and \a j.
     336    /// @brief Swap columns \a i and \a j.
    338337    ///
    339338    inline int swap_columns(const size_t i,const size_t j)
     
    341340
    342341    ///
    343     /// Swap row \a i and column \a j.
     342    /// @brief Swap row \a i and column \a j.
    344343    ///
    345344    inline int swap_rowcol(const size_t i,const size_t j)
     
    347346
    348347    ///
    349     /// Swap rows \a i and \a j.
     348    /// @brief Swap rows \a i and \a j.
    350349    ///
    351350    inline int swap_rows(const size_t i, const size_t j)
     
    353352
    354353    ///
    355     /// Transpose the matrix.
     354    /// @brief Transpose the matrix.
    356355    ///
    357356    void transpose(void);
     
    371370
    372371    ///
    373     /// Matrix-vector multiplication.
     372    /// @brief Matrix-vector multiplication.
    374373    ///
    375374    /// @return The resulting vector.
     
    379378
    380379    ///
    381     /// Comparison operator.
     380    /// @brief Comparison operator.
    382381    ///
    383382    /// @return True if all elements are equal otherwise False.
     
    388387
    389388    ///
    390     /// Comparison operator.
     389    /// @brief Comparison operator.
    391390    ///
    392391    /// @return False if all elements are equal otherwise True.
     
    397396
    398397    ///
    399     /// The assignment operator. There is no requirements on
    400     /// dimensions, i.e. the matrix is remapped in memory if
    401     /// necessary. This implies that in general views cannot be
    402     /// assigned using this operator. Views will be mutated into
    403     /// normal matrices. The only exception to this behaviour on views
    404     /// is when self-assignemnt is done, since self-assignment is
    405     /// ignored.
     398    /// @brief The assignment operator.
     399    ///
     400    /// There is no requirements on dimensions, i.e. the matrix is
     401    /// remapped in memory if necessary. This implies that in general
     402    /// views cannot be assigned using this operator. Views will be
     403    /// mutated into normal matrices. The only exception to this
     404    /// behaviour on views is when self-assignemnt is done, since
     405    /// self-assignment is ignored.
    406406    ///
    407407    /// @return A const reference to the resulting matrix.
     
    412412
    413413    ///
    414     /// Add and assign operator.
    415     ///
    416     inline const matrix& operator+=(const matrix& m) { add(m); return *this; }
    417 
    418     ///
    419     /// Add and assign operator.
    420     ///
    421     inline const matrix&
    422     operator+=(const double d) { add_constant(d); return *this; }
    423 
    424     ///
    425     /// Subtract and assign operator.
    426     ///
    427     inline const matrix& operator-=(const matrix& m) { sub(m); return *this; }
    428 
    429     ///
    430     /// Multiply and assigment operator.
     414    /// @brief Add and assign operator.
     415    ///
     416    const matrix& operator+=(const matrix&);
     417
     418    ///
     419    /// @brief Add and assign operator.
     420    ///
     421    const matrix& operator+=(const double);
     422
     423    ///
     424    /// @brief Subtract and assign operator.
     425    ///
     426    const matrix& operator-=(const matrix&);
     427
     428    ///
     429    /// @brief Multiply and assigment operator.
    431430    ///
    432431    /// @return Const reference to the resulting matrix.
     
    435434
    436435    ///
    437     /// Multiply and assign operator.
    438     ///
    439     inline const matrix& operator*=(const double d) { scale(d); return *this; }
    440 
     436    /// @brief Multiply and assignment operator
     437    ///
     438    const matrix& operator*=(const double);
    441439
    442440  private:
  • trunk/yat/utility/stl_utility.h

    r687 r703  
    120120
    121121  ///
    122   /// Function converting a string to lower case
     122  /// @brief Function converting a string to lower case
    123123  ///
    124124  inline void to_lower(std::string& s) {
     
    127127
    128128  ///
    129   /// Function converting a string to upper case
     129  /// @brief Function converting a string to upper case
    130130  ///
    131131  inline void to_upper(std::string& s) {
  • trunk/yat/utility/vector.cc

    r686 r703  
    258258
    259259
     260  const vector& vector::operator+=(const vector& other)
     261  {
     262    gsl_vector_add(v_,other.v_);
     263    return *this;
     264  }
     265
     266
     267  const vector& vector::operator-=(const vector& other)
     268  {
     269    gsl_vector_sub(v_,other.v_);
     270    return *this;
     271  }
     272
     273
     274  const vector& vector::operator*=(const double d)
     275  {
     276    gsl_vector_scale(v_,d);
     277    return *this;
     278  }
     279
     280
    260281  std::ostream& operator<<(std::ostream& s, const vector& a)
    261282  {
  • trunk/yat/utility/vector.h

    r693 r703  
    434434
    435435    ///
     436    /// @return The dot product.
     437    ///
     438    double operator*(const vector&) const;
     439
     440    ///
    436441    /// Comparison operator. Takes linear time.
    437442    ///
     
    457462
    458463    ///
    459     /// @return The dot product.
    460     ///
    461     double operator*( const vector &other ) const;
    462 
    463     ///
    464464    /// Addition and assign operator.
    465465    ///
    466466    /// @return A const reference to the resulting vector.
    467467    ///
    468     inline const vector&
    469     operator+=(const vector& other) { gsl_vector_add(v_,other.v_); return *this;}
     468    const vector& operator+=(const vector&);
    470469
    471470    ///
     
    474473    /// @return A const reference to the resulting vector.
    475474    ///
    476     inline const vector&
    477     operator-=(const vector& other) { gsl_vector_sub(v_,other.v_); return *this;}
     475    const vector& operator-=(const vector&);
    478476
    479477    ///
     
    482480    /// @return A const reference to the resulting vector.
    483481    ///
    484     inline const vector&
    485     operator*=(const double d) { gsl_vector_scale(v_,d); return *this; }
     482    const vector& operator*=(const double);
    486483
    487484
Note: See TracChangeset for help on using the changeset viewer.