Changeset 1120 for trunk/yat


Ignore:
Timestamp:
Feb 22, 2008, 12:18:41 AM (14 years ago)
Author:
Peter
Message:

vector is now Vector

Location:
trunk/yat
Files:
37 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/DataLookup1D.cc

    r1080 r1120  
    2929
    3030#include "yat/utility/matrix.h"
    31 #include "yat/utility/vector.h"
     31#include "yat/utility/Vector.h"
    3232
    3333#include <cassert>
  • trunk/yat/classifier/IGP.h

    r1050 r1120  
    2828#include "MatrixLookup.h"
    2929#include "Target.h"
    30 #include "yat/utility/vector.h"
     30#include "yat/utility/Vector.h"
    3131#include "yat/utility/yat_assert.h"
    3232
     
    6565    /// @return the IGP score for each class as elements in a vector.
    6666    ///
    67     const utility::vector& score(void) const;
     67    const utility::Vector& score(void) const;
    6868
    6969
    7070  private:
    71     utility::vector igp_;
     71    utility::Vector igp_;
    7272    Distance distance_;
    7373
     
    8686   
    8787    // Calculate IGP for each class
    88     igp_ = utility::vector(target_.nof_classes());
     88    igp_ = utility::Vector(target_.nof_classes());
    8989   
    9090    for(u_int i=0; i<target_.size(); i++) {
     
    116116 
    117117  template <typename Distance>
    118   const utility::vector& IGP<Distance>::score(void) const
     118  const utility::Vector& IGP<Distance>::score(void) const
    119119  {
    120120    return igp_;
  • trunk/yat/classifier/NBC.cc

    r1042 r1120  
    101101          assert(i<centroids_.rows());
    102102          assert(j<centroids_.columns());
    103           centroids_(i,j) = aver[j].mean();
    104103          assert(i<sigma2_.rows());
    105104          assert(j<sigma2_.columns());
    106           if (aver[j].n()>1)
     105          if (aver[j].n()>1){
    107106            sigma2_(i,j) = aver[j].variance();
    108           else
     107            centroids_(i,j) = aver[j].mean();
     108          }
     109          else {
    109110            sigma2_(i,j) = std::numeric_limits<double>::quiet_NaN();
     111            centroids_(i,j) = std::numeric_limits<double>::quiet_NaN();
     112          }
    110113        }
    111114      }
     
    125128          assert(i<sigma2_.rows());
    126129          assert(j<sigma2_.columns());
    127           if (aver[j].n()>1)
     130          if (aver[j].n()>1){
    128131            sigma2_(i,j) = aver[j].variance();
    129           else
     132            centroids_(i,j) = aver[j].mean();
     133          }
     134          else {
    130135            sigma2_(i,j) = std::numeric_limits<double>::quiet_NaN();
     136            centroids_(i,j) = std::numeric_limits<double>::quiet_NaN();
     137          }
    131138        }
    132139      }
     
    142149    assert(x.rows()==sigma2_.rows());
    143150    assert(x.rows()==centroids_.rows());
    144 
    145151   
    146152   
     
    192198    // problems when calculating P = exp(- -lnP), we centralize matrix
    193199    // by adding a constant.
    194     double m=0;
    195     for (size_t i=0; i<prediction.rows(); ++i)
    196       for (size_t j=0; j<prediction.columns(); ++j)
    197         m+=prediction(i,j);
    198     prediction -= m/prediction.rows()/prediction.columns();
     200    statistics::Averager a;
     201    add(a, prediction.begin(), prediction.end());
     202    prediction -= a.mean();
    199203
    200204    // exponentiate
  • trunk/yat/classifier/NCC.h

    r1115 r1120  
    3838#include "yat/statistics/AveragerWeighted.h"
    3939#include "yat/utility/matrix.h"
    40 #include "yat/utility/vector.h"
     40#include "yat/utility/Vector.h"
    4141#include "yat/utility/stl_utility.h"
    4242#include "yat/utility/yat_assert.h"
  • trunk/yat/classifier/SVM.cc

    r1108 r1120  
    3030#include "yat/statistics/Averager.h"
    3131#include "yat/utility/matrix.h"
    32 #include "yat/utility/vector.h"
     32#include "yat/utility/Vector.h"
    3333
    3434#include <algorithm>
     
    7676
    7777
    78   const utility::vector& SVM::alpha(void) const
     78  const utility::Vector& SVM::alpha(void) const
    7979  {
    8080    return alpha_;
     
    134134
    135135
    136   const theplu::yat::utility::vector& SVM::output(void) const
     136  const utility::Vector& SVM::output(void) const
    137137  {
    138138    return output_;
     
    186186    target_ = targ;
    187187   
    188     alpha_ = utility::vector(targ.size(), 0.0);
    189     output_ = utility::vector(targ.size(), 0.0);
     188    alpha_ = utility::Vector(targ.size(), 0.0);
     189    output_ = utility::Vector(targ.size(), 0.0);
    190190    // initializing variables for optimization
    191191    assert(target_.size()==kernel_->rows());
     
    193193
    194194    sample_.init(alpha_,tolerance_);
    195     utility::vector   E(target_.size(),0);
     195    utility::Vector   E(target_.size(),0);
    196196    for (size_t i=0; i<E.size(); i++) {
    197197      for (size_t j=0; j<E.size(); j++)
     
    273273
    274274
    275   bool SVM::choose(const theplu::yat::utility::vector& E)
     275  bool SVM::choose(const theplu::yat::utility::Vector& E)
    276276  {
    277277    // First check for violation among SVs
  • trunk/yat/classifier/SVM.h

    r1108 r1120  
    2929#include "SVindex.h"
    3030#include "Target.h"
    31 #include "yat/utility/vector.h"
     31#include "yat/utility/Vector.h"
    3232
    3333#include <utility>
     
    8181    /// @return \f$ \alpha \f$
    8282    ///
    83     const utility::vector& alpha(void) const;
     83    const utility::Vector& alpha(void) const;
    8484
    8585    ///
     
    117117        @return output
    118118    */
    119     const theplu::yat::utility::vector& output(void) const;
     119    const theplu::yat::utility::Vector& output(void) const;
    120120
    121121    /**
     
    215215    ///  can be found
    216216    ///
    217     bool choose(const theplu::yat::utility::vector&);
     217    bool choose(const theplu::yat::utility::Vector&);
    218218
    219219    ///
     
    227227    int target(size_t i) const;
    228228
    229     utility::vector alpha_;
     229    utility::Vector alpha_;
    230230    double bias_;
    231231    double C_inverse_;
     
    233233    double margin_;
    234234    unsigned long int max_epochs_;
    235     utility::vector output_;
     235    utility::Vector output_;
    236236    SVindex sample_;
    237237    Target target_;
  • trunk/yat/classifier/SVindex.cc

    r1100 r1120  
    2727#include "yat/statistics/Averager.h"
    2828#include "yat/utility/matrix.h"
    29 #include "yat/utility/vector.h"
     29#include "yat/utility/Vector.h"
    3030
    3131#include <algorithm>
     
    6565  }
    6666
    67   void SVindex::init(const utility::vector& alpha, const double tol)
     67  void SVindex::init(const utility::Vector& alpha, const double tol)
    6868  {
    6969    nof_sv_=0;
  • trunk/yat/classifier/SVindex.h

    r1000 r1120  
    3232
    3333namespace utility {
    34   class vector;
     34  class Vector;
    3535}
    3636
     
    5959
    6060    /// synch the object against alpha
    61     void init(const utility::vector& alpha, const double);
     61    void init(const utility::Vector& alpha, const double);
    6262
    6363    /// @return nof support vectors
  • trunk/yat/classifier/utility.cc

    r1009 r1120  
    2626#include "DataLookup1D.h"
    2727#include "DataLookupWeighted1D.h"
    28 #include "yat/utility/vector.h"
     28#include "yat/utility/Vector.h"
    2929
    3030
     
    3333namespace classifier {
    3434
    35   void convert(const DataLookup1D& lookup, utility::vector& vector)
     35  void convert(const DataLookup1D& lookup, utility::Vector& vector)
    3636  {
    37     vector = utility::vector(lookup.size());
     37    vector = utility::Vector(lookup.size());
    3838    for(u_int i=0; i<lookup.size(); i++)
    3939      vector(i)=lookup(i);
    4040  }
    4141
    42   void convert(const DataLookupWeighted1D& lookup, utility::vector& value,
    43                utility::vector& weight)
     42  void convert(const DataLookupWeighted1D& lookup, utility::Vector& value,
     43               utility::Vector& weight)
    4444  {
    4545   
    46     value = utility::vector(lookup.size());
    47     weight = utility::vector(lookup.size());
     46    value = utility::Vector(lookup.size());
     47    weight = utility::Vector(lookup.size());
    4848    for(u_int i=0; i<lookup.size(); i++){
    4949      value(i)=lookup.data(i);
  • trunk/yat/classifier/utility.h

    r1000 r1120  
    3030
    3131  namespace utility {
    32     class vector;
     32    class Vector;
    3333  }
    3434
     
    4141  /// Converts a DataLookup1D to a utility::vector
    4242  ///
    43   void convert(const DataLookup1D&, utility::vector&);
     43  void convert(const DataLookup1D&, utility::Vector&);
    4444
    4545  ///
    4646  /// Converts a DataLookupWeighted1D to two utility::vector
    4747  ///
    48   void convert(const DataLookupWeighted1D&, utility::vector& value,
    49                utility::vector& weight);
     48  void convert(const DataLookupWeighted1D&, utility::Vector& value,
     49               utility::Vector& weight);
    5050
    5151}}} // of namespace classifier, yat, and theplu
  • trunk/yat/regression/LinearWeighted.cc

    r1043 r1120  
    2626#include "LinearWeighted.h"
    2727#include "yat/statistics/AveragerPairWeighted.h"
    28 #include "yat/utility/vector.h"
     28#include "yat/utility/Vector.h"
    2929
    3030#include <cassert>
     
    7575    // want.
    7676    ap_.reset();
    77     yat::utility::vector dummy(x.size(), 1.0);
     77    yat::utility::Vector dummy(x.size(), 1.0);
    7878    add(ap_, x.begin(), x.end(), y.begin(),dummy.begin(),w.begin());
    7979
  • trunk/yat/regression/Local.cc

    r1049 r1120  
    2626#include "Kernel.h"
    2727#include "OneDimensionalWeighted.h"
    28 #include "yat/utility/vector.h"
     28#include "yat/utility/Vector.h"
    2929#include "yat/utility/VectorView.h"
    3030
     
    6868
    6969    size_t nof_fits=data_.size()/step_size;
    70     x_ = utility::vector(nof_fits);
    71     y_predicted_ = utility::vector(x_.size());
    72     y_err_ = utility::vector(x_.size());
     70    x_ = utility::Vector(nof_fits);
     71    y_predicted_ = utility::Vector(x_.size());
     72    y_err_ = utility::Vector(x_.size());
    7373    sort(data_.begin(), data_.end());
    7474
    7575    // coying data to 2 utility vectors ONCE to use views from
    76     utility::vector x(data_.size());
    77     utility::vector y(data_.size());
     76    utility::Vector x(data_.size());
     77    utility::Vector y(data_.size());
    7878    for (size_t j=0; j<x.size(); j++){
    7979      x(j)=data_[j].first;
     
    115115
    116116      // calculating weights
    117       utility::vector w(max_index-min_index+1);
     117      utility::Vector w(max_index-min_index+1);
    118118      for (size_t j=0; j<w.size(); j++)
    119119        w(j) = (*kernel_)( (x_local(j)- x_mid)/width );
     
    128128  }
    129129
    130   const utility::vector& Local::x(void) const
     130  const utility::Vector& Local::x(void) const
    131131  {
    132132    return x_;
    133133  }
    134134
    135   const utility::vector& Local::y_predicted(void) const
     135  const utility::Vector& Local::y_predicted(void) const
    136136  {
    137137    return y_predicted_;
    138138  }
    139139
    140   const utility::vector& Local::y_err(void) const
     140  const utility::Vector& Local::y_err(void) const
    141141  {
    142142    return y_err_;
  • trunk/yat/regression/Local.h

    r1000 r1120  
    2727*/
    2828
    29 #include "yat/utility/vector.h"
     29#include "yat/utility/Vector.h"
    3030
    3131#include <iostream>
     
    7878    /// @return x-values where fitting was performed.
    7979    ///
    80     const utility::vector& x(void) const;
     80    const utility::Vector& x(void) const;
    8181
    8282    ///
    8383    /// Function returning predicted values
    8484    ///
    85     const utility::vector& y_predicted(void) const;
     85    const utility::Vector& y_predicted(void) const;
    8686
    8787    ///
    8888    /// Function returning error of predictions
    8989    ///
    90     const utility::vector& y_err(void) const;
     90    const utility::Vector& y_err(void) const;
    9191
    9292  private:
     
    9999    Kernel* kernel_;
    100100    OneDimensionalWeighted* regressor_;
    101     utility::vector x_;
    102     utility::vector y_predicted_;
    103     utility::vector y_err_;
     101    utility::Vector x_;
     102    utility::Vector y_predicted_;
     103    utility::Vector y_err_;
    104104  };
    105105
  • trunk/yat/regression/MultiDimensional.cc

    r1098 r1120  
    2727#include "yat/utility/matrix.h"
    2828#include "yat/utility/VectorBase.h"
    29 #include "yat/utility/vector.h"
     29#include "yat/utility/Vector.h"
    3030
    3131#include <cassert>
     
    6060    assert(x.rows()==y.size());
    6161    covariance_.resize(x.columns(),x.columns());
    62     fit_parameters_ = utility::vector(x.columns());
     62    fit_parameters_ = utility::Vector(x.columns());
    6363    if (work_)
    6464      gsl_multifit_linear_free(work_);
     
    7676  }
    7777
    78   const utility::vector& MultiDimensional::fit_parameters(void) const
     78  const utility::Vector& MultiDimensional::fit_parameters(void) const
    7979  {
    8080    return fit_parameters_;
  • trunk/yat/regression/MultiDimensional.h

    r1021 r1120  
    6969    /// @return parameters of the model
    7070    ///
    71     const utility::vector& fit_parameters(void) const;
     71    const utility::Vector& fit_parameters(void) const;
    7272
    7373    /**
     
    9696    double s2_;
    9797    utility::matrix covariance_;
    98     utility::vector fit_parameters_;
     98    utility::Vector fit_parameters_;
    9999    gsl_multifit_linear_workspace* work_;
    100100
  • trunk/yat/regression/MultiDimensionalWeighted.cc

    r1098 r1120  
    2525#include "yat/statistics/AveragerWeighted.h"
    2626#include "yat/utility/matrix.h"
    27 #include "yat/utility/vector.h"
     27#include "yat/utility/Vector.h"
    2828
    2929#include <cassert>
     
    5959
    6060    covariance_.resize(x.columns(),x.columns());
    61     fit_parameters_ = utility::vector(x.columns());
     61    fit_parameters_ = utility::Vector(x.columns());
    6262    if (work_)
    6363      gsl_multifit_linear_free(work_);
     
    8080
    8181
    82   const utility::vector& MultiDimensionalWeighted::fit_parameters(void) const
     82  const utility::Vector& MultiDimensionalWeighted::fit_parameters(void) const
    8383  {
    8484    return fit_parameters_;
  • trunk/yat/regression/MultiDimensionalWeighted.h

    r1022 r1120  
    2626
    2727#include "yat/utility/matrix.h"
    28 #include "yat/utility/vector.h"
     28#include "yat/utility/Vector.h"
    2929
    3030#include <gsl/gsl_multifit.h>
     
    8585    /// @return parameters of fitted model
    8686    ///
    87     const utility::vector& fit_parameters(void) const;
     87    const utility::Vector& fit_parameters(void) const;
    8888
    8989    ///
     
    9595    double chisquare_;
    9696    utility::matrix covariance_;
    97     utility::vector fit_parameters_;
     97    utility::Vector fit_parameters_;
    9898    double s2_;
    9999    gsl_multifit_linear_workspace* work_;
  • trunk/yat/regression/NaiveWeighted.cc

    r1043 r1120  
    2727#include "OneDimensional.h"
    2828#include "yat/statistics/AveragerWeighted.h"
    29 #include "yat/utility/vector.h"
     29#include "yat/utility/Vector.h"
    3030
    3131#include <cassert>
     
    5151    assert(y.size()==w.size());
    5252    ap_.reset();
    53     utility::vector dummy(x.size(),1.0);
     53    utility::Vector dummy(x.size(),1.0);
    5454    add(ap_, x.begin(), x.end(), y.begin(),dummy.begin(), w.begin());
    5555    chisq_ = ap_.y_averager().sum_xx_centered();
  • trunk/yat/regression/Polynomial.cc

    r1043 r1120  
    6262
    6363
    64   const utility::vector& Polynomial::fit_parameters(void) const
     64  const utility::Vector& Polynomial::fit_parameters(void) const
    6565  {
    6666    return md_.fit_parameters();
     
    7070  double Polynomial::predict(const double x) const
    7171  {
    72     utility::vector vec(power_+1,1);
     72    utility::Vector vec(power_+1,1);
    7373    for (size_t i=1; i<=power_; ++i)
    7474      vec(i) = vec(i-1)*x;
     
    8585  double Polynomial::standard_error2(const double x) const
    8686  {
    87     utility::vector vec(power_+1,1);
     87    utility::Vector vec(power_+1,1);
    8888    for (size_t i=1; i<=power_; ++i)
    8989      vec(i) = vec(i-1)*x;
  • trunk/yat/regression/Polynomial.h

    r1019 r1120  
    7272    /// @see MultiDimensional
    7373    ///
    74     const utility::vector& fit_parameters(void) const;
     74    const utility::Vector& fit_parameters(void) const;
    7575
    7676    ///
  • trunk/yat/regression/PolynomialWeighted.cc

    r1043 r1120  
    2525#include "PolynomialWeighted.h"
    2626#include "yat/utility/matrix.h"
    27 #include "yat/utility/vector.h"
     27#include "yat/utility/Vector.h"
    2828
    2929#include <cassert>
     
    5252    // product wx*wy, so we can send in w and a dummie to get what we
    5353    // want.
    54     utility::vector dummy(x.size(), 1.0);
     54    utility::Vector dummy(x.size(), 1.0);
    5555    add(ap_,x.begin(), x.end(),y.begin(),dummy.begin(),w.begin());
    5656    utility::matrix X=utility::matrix(x.size(),power_+1,1);
     
    6363
    6464
    65   const utility::vector& PolynomialWeighted::fit_parameters(void) const
     65  const utility::Vector& PolynomialWeighted::fit_parameters(void) const
    6666  {
    6767    return md_.fit_parameters();
     
    7676  double PolynomialWeighted::predict(const double x) const
    7777  {
    78     utility::vector vec(power_+1,1);
     78    utility::Vector vec(power_+1,1);
    7979    for (size_t i=1; i<=power_; ++i)
    8080      vec(i) = vec(i-1)*x;
     
    8484  double PolynomialWeighted::standard_error2(const double x) const
    8585  {
    86     utility::vector vec(power_+1,1);
     86    utility::Vector vec(power_+1,1);
    8787    for (size_t i=1; i<=power_; ++i)
    8888      vec(i) = vec(i-1)*x;
  • trunk/yat/regression/PolynomialWeighted.h

    r1020 r1120  
    2727#include "OneDimensionalWeighted.h"
    2828#include "MultiDimensionalWeighted.h"
    29 #include "yat/utility/vector.h"
     29#include "yat/utility/Vector.h"
    3030
    3131namespace theplu {
     
    6565    /// @see MultiDimensional
    6666    ///
    67     const utility::vector& fit_parameters(void) const;
     67    const utility::Vector& fit_parameters(void) const;
    6868
    6969    ///
  • trunk/yat/statistics/FoldChange.cc

    r1023 r1120  
    3030#include "yat/classifier/DataLookupWeighted1D.h"
    3131#include "yat/classifier/Target.h"
    32 #include "yat/utility/vector.h"
     32#include "yat/utility/VectorBase.h"
    3333
    3434namespace theplu {
  • trunk/yat/statistics/ROC.cc

    r1000 r1120  
    2929#include "yat/classifier/Target.h"
    3030#include "yat/utility/stl_utility.h"
    31 #include "yat/utility/vector.h"
     31#include "yat/utility/VectorBase.h"
    3232
    3333#include <gsl/gsl_cdf.h>
  • trunk/yat/statistics/Score.cc

    r1000 r1120  
    3030#include "yat/classifier/Target.h"
    3131#include "yat/classifier/utility.h"
    32 #include "yat/utility/vector.h"
     32#include "yat/utility/Vector.h"
    3333
    3434#include <cassert>
     
    5656  {
    5757    assert(target.size()==value.size());
    58     utility::vector a(value.size());
     58    utility::Vector a(value.size());
    5959    classifier::convert(value,a);
    6060    return score(target,a);
     
    6666  {
    6767    assert(target.size()==value.size());
    68     utility::vector a(value.size());
    69     utility::vector b(value.size());
     68    utility::Vector a(value.size());
     69    utility::Vector b(value.size());
    7070    classifier::convert(value,a,b);
    7171    return score(target,a,b);
     
    7777                      const classifier::DataLookup1D& weight) const
    7878  {
    79     utility::vector a(value.size());
     79    utility::Vector a(value.size());
    8080    classifier::convert(value,a);
    81     utility::vector b(value.size());
     81    utility::Vector b(value.size());
    8282    classifier::convert(weight,a);
    8383    return score(target,a,b);
  • trunk/yat/utility/Alignment.cc

    r1000 r1120  
    2626#include "Alignment.h"
    2727#include "matrix.h"
    28 #include "yat/utility/stl_utility.h"
     28#include "stl_utility.h"
    2929
    3030#include <algorithm>
  • trunk/yat/utility/Makefile.am

    r1110 r1120  
    2929  matrix.cc NNI.cc Option.cc OptionFile.cc OptionInFile.cc OptionOutFile.cc \
    3030  OptionHelp.cc OptionSwitch.cc \
    31   PCA.cc stl_utility.cc SVD.cc TypeInfo.cc utility.cc vector.cc \
     31  PCA.cc stl_utility.cc SVD.cc TypeInfo.cc utility.cc Vector.cc \
    3232  VectorBase.cc VectorConstView.cc VectorMutable.cc VectorView.cc WeNNI.cc
    3333
     
    4242  OptionHelp.h OptionSwitch.h \
    4343  PCA.h SmartPtr.h stl_utility.h StrideIterator.h \
    44   SVD.h TypeInfo.h utility.h vector.h \
     44  SVD.h TypeInfo.h utility.h Vector.h \
    4545  VectorBase.h VectorConstView.h VectorMutable.h VectorView.h \
    4646  WeNNI.h yat_assert.h
  • trunk/yat/utility/PCA.cc

    r1098 r1120  
    4747
    4848
    49   const utility::vector& PCA::eigenvalues(void) const
     49  const utility::Vector& PCA::eigenvalues(void) const
    5050  {
    5151    return eigenvalues_;
     
    147147    utility::matrix projs( Ncol, Ncol );
    148148
    149     utility::vector temp(samples.rows());
     149    utility::Vector temp(samples.rows());
    150150    for( size_t j = 0; j < Ncol; ++j ) {
    151151      for (size_t i=0; i<Ncol; ++i )
    152152        temp(i) = samples(i,j);
    153       utility::vector centered( Nrow );
     153      utility::Vector centered( Nrow );
    154154      for( size_t i = 0; i < Nrow; ++i )
    155155        centered(i) = temp(i) - meanvalues_(i);
    156       utility::vector proj( eigenvectors_ * centered );
     156      utility::Vector proj( eigenvectors_ * centered );
    157157      for( size_t i = 0; i < Ncol; ++i )
    158158        projs(i,j)=proj(i);
     
    191191  void PCA::row_center(utility::matrix& A_center)
    192192  {
    193     meanvalues_ = vector(A_.rows());
    194     utility::vector A_row_sum(A_.rows());
     193    meanvalues_ = Vector(A_.rows());
     194    utility::Vector A_row_sum(A_.rows());
    195195    for (size_t i=0; i<A_row_sum.size(); ++i){
    196196      A_row_sum(i) = sum(A_.row_const_view(i));
  • trunk/yat/utility/PCA.h

    r1000 r1120  
    3030
    3131#include "matrix.h"
    32 #include "vector.h"
     32#include "Vector.h"
    3333
    3434namespace theplu {
     
    7373       eigenvalues.
    7474    */
    75     const utility::vector& eigenvalues(void) const;
     75    const utility::Vector& eigenvalues(void) const;
    7676
    7777    /**
     
    119119
    120120    utility::matrix A_;
    121     utility::vector eigenvalues_;
     121    utility::Vector eigenvalues_;
    122122    utility::matrix eigenvectors_;
    123     utility::vector meanvalues_;
     123    utility::Vector meanvalues_;
    124124  };
    125125
  • trunk/yat/utility/SVD.cc

    r1016 r1120  
    2626
    2727#include "SVD.h"
    28 #include "vector.h"
     28#include "Vector.h"
    2929#include "VectorBase.h"
    3030
     
    7272  int SVD::golub_reinsch(void)
    7373  {
    74     utility::vector w(U_.columns());
     74    utility::Vector w(U_.columns());
    7575    return gsl_linalg_SV_decomp(U_.gsl_matrix_p(), V_.gsl_matrix_p(),
    7676                                s_.gsl_vector_p(), w.gsl_vector_p());
     
    8787  int SVD::modified_golub_reinsch(void)
    8888  {
    89     utility::vector w(U_.columns());
     89    utility::Vector w(U_.columns());
    9090    utility::matrix X(U_.columns(),U_.columns());
    9191    return gsl_linalg_SV_decomp_mod(U_.gsl_matrix_p(), X.gsl_matrix_p(),
     
    9595
    9696
    97   const utility::vector& SVD::s(void) const
     97  const utility::Vector& SVD::s(void) const
    9898  {
    9999    return s_;
     
    101101
    102102
    103   void SVD::solve(const utility::VectorBase& b, utility::vector& x)
     103  void SVD::solve(const utility::VectorBase& b, utility::Vector& x)
    104104  {
    105105    int status=gsl_linalg_SV_solve(U_.gsl_matrix_p(), V_.gsl_matrix_p(),
  • trunk/yat/utility/SVD.h

    r1016 r1120  
    3030
    3131#include "matrix.h"
    32 #include "vector.h"
     32#include "Vector.h"
    3333
    3434#include <gsl/gsl_linalg.h>
     
    103103       is undefined.
    104104    */
    105     const utility::vector& s(void) const;
     105    const utility::Vector& s(void) const;
    106106
    107107    /**
     
    114114       \throw GSL_error if the underlying GSL function fails.
    115115    */
    116     void solve(const utility::VectorBase& b, utility::vector& x);
     116    void solve(const utility::VectorBase& b, utility::Vector& x);
    117117
    118118    /**
     
    159159
    160160    utility::matrix U_, V_;
    161     utility::vector s_;
     161    utility::Vector s_;
    162162  }; 
    163163
  • trunk/yat/utility/Vector.cc

    r1118 r1120  
    2525*/
    2626
    27 #include "vector.h"
     27#include "Vector.h"
    2828#include "matrix.h"
    2929#include "utility.h"
     
    4343
    4444
    45   vector::vector(void)
     45  Vector::Vector(void)
    4646    : VectorMutable()
    4747  {
     
    4949
    5050
    51   vector::vector(size_t n, double init_value)
     51  Vector::Vector(size_t n, double init_value)
    5252    : VectorMutable(gsl_vector_alloc(n))
    5353  {
    5454    if (!vec_)
    55       throw utility::GSL_error("vector::vector failed to allocate memory");
     55      throw utility::GSL_error("Vector::Vector failed to allocate memory");
    5656    assert(const_vec_);
    5757    all(init_value);
     
    5959
    6060
    61   vector::vector(const vector& other)
     61  Vector::Vector(const Vector& other)
    6262    : VectorMutable(create_gsl_vector_copy(other))
    6363  {
     
    6565
    6666
    67   vector::vector(const VectorBase& other)
     67  Vector::Vector(const VectorBase& other)
    6868    : VectorMutable(create_gsl_vector_copy(other))
    6969  {
     
    7171
    7272
    73   vector::vector(std::istream& is, char sep)
     73  Vector::Vector(std::istream& is, char sep)
    7474    throw (utility::IO_error, std::exception)
    7575    : VectorMutable()
     
    117117      else if (nof_rows && (nof_columns>1)) {
    118118        std::ostringstream s;
    119         s << "vector::vector(std::istream&) data file error:\n"
     119        s << "Vector::Vector(std::istream&) data file error:\n"
    120120          << "    File has inconsistent number of rows (" << nof_rows
    121121          << ") and columns (" << nof_columns
    122           << ").\n    Expected a row or a column vector.";
     122          << ").\n    Expected a row or a column Vector.";
    123123        throw utility::IO_error(s.str());
    124124      }
    125125      else if (v.size()!=nof_columns) {
    126126        std::ostringstream s;
    127         s << "vector::vector(std::istream&) data file error:\n"
     127        s << "Vector::Vector(std::istream&) data file error:\n"
    128128          << "    Line " << nof_rows << " has " << v.size()
    129129          << " columns; expected " << nof_columns << " column.";
     
    138138    vec_ = gsl_vector_alloc(nof_rows*nof_columns);
    139139    if (!vec_)
    140       throw utility::GSL_error("vector::vector failed to allocate memory");
     140      throw utility::GSL_error("Vector::Vector failed to allocate memory");
    141141    size_t n=0;
    142142    // if gsl error handler disabled, out of bounds index will not
     
    149149
    150150
    151   vector::~vector(void)
     151  Vector::~Vector(void)
    152152  {
    153153    delete_allocated_memory();
     
    155155
    156156
    157   const vector& vector::assign(const VectorBase& other)
     157  const Vector& Vector::assign(const VectorBase& other)
    158158  {
    159159    delete_allocated_memory();
     
    162162        vec_ = gsl_vector_alloc(other.size());
    163163      if (!vec_)
    164         throw utility::GSL_error("vector failed to allocate memory");
     164        throw utility::GSL_error("Vector failed to allocate memory");
    165165      gsl_vector_memcpy(vec_,other.gsl_vector_p());
    166166      const_vec_ = vec_;
     
    170170
    171171
    172   gsl_vector* vector::create_gsl_vector_copy(const VectorBase& other) const
     172  gsl_vector* Vector::create_gsl_vector_copy(const VectorBase& other) const
    173173  {
    174174    gsl_vector* vec = gsl_vector_alloc(other.size());
    175175    if (!vec)
    176       throw utility::GSL_error("vector::create_gsl_vector_copy failed to allocate memory");
     176      throw utility::GSL_error("Vector::create_gsl_vector_copy failed to allocate memory");
    177177    if (gsl_vector_memcpy(vec, other.gsl_vector_p()))
    178       throw utility::GSL_error("vector::create_gsl_matrix_copy dimension mis-match");
     178      throw utility::GSL_error("Vector::create_gsl_matrix_copy dimension mis-match");
    179179    return vec;
    180180  }
    181181
    182182
    183   void vector::delete_allocated_memory(void)
     183  void Vector::delete_allocated_memory(void)
    184184  {
    185185    if (vec_)
     
    189189
    190190
    191   bool vector::isview(void) const
     191  bool Vector::isview(void) const
    192192  {
    193193    return false;
     
    195195
    196196
    197   void vector::resize(size_t n, double init_value)
     197  void Vector::resize(size_t n, double init_value)
    198198  {
    199199    delete_allocated_memory();
    200200    const_vec_ = vec_ = gsl_vector_alloc(n);
    201201    if (!vec_)
    202       throw utility::GSL_error("vector::vector failed to allocate memory");
     202      throw utility::GSL_error("Vector::Vector failed to allocate memory");
    203203    all(init_value);
    204204  }
    205205
    206206
    207   void set_basis(vector& v, size_t i)
     207  void set_basis(Vector& v, size_t i)
    208208  {
    209209    assert(v.gsl_vector_p());
     
    212212
    213213
    214   void sort(vector& v)
     214  void sort(Vector& v)
    215215  {
    216216    assert(v.gsl_vector_p());
     
    219219
    220220
    221   void swap(vector& v, vector& w)
     221  void swap(Vector& v, Vector& w)
    222222  {
    223223    assert(v.gsl_vector_p()); assert(w.gsl_vector_p());
    224224    int status=gsl_vector_swap(v.gsl_vector_p(),w.gsl_vector_p());
    225225    if (status)
    226       throw utility::GSL_error(std::string("swap(vector&,vector&)",status));
    227   }
    228 
    229 
    230   const vector& vector::operator=( const VectorBase& other )
     226      throw utility::GSL_error(std::string("swap(Vector&,Vector&)",status));
     227  }
     228
     229
     230  const Vector& Vector::operator=( const VectorBase& other )
    231231  {
    232232    return assign(other);
     
    234234
    235235
    236   const vector& vector::operator=( const vector& other )
     236  const Vector& Vector::operator=( const Vector& other )
    237237  {
    238238    return assign(other);
  • trunk/yat/utility/Vector.h

    r1118 r1120  
    5858  */
    5959
    60   class vector : public VectorMutable
     60  class Vector : public VectorMutable
    6161  {
    6262  public:
     
    6464       \brief The default constructor.
    6565    */
    66     vector(void);
     66    Vector(void);
    6767
    6868    /**
     
    7272       \throw GSL_error if memory allocation fails.
    7373    */
    74     vector(size_t n, double init_value=0);
     74    Vector(size_t n, double init_value=0);
    7575
    7676    /**
     
    8080       fails.
    8181    */
    82     vector(const vector& other);
     82    Vector(const Vector& other);
    8383
    8484    /**
     
    8888       fails.
    8989    */
    90     vector(const VectorBase& other);
     90    Vector(const VectorBase& other);
    9191
    9292    /**
     
    9797       sep. When delimiter \a sep is used empty elements are stored as
    9898       NaN's (except that empty lines are ignored). The end of input
    99        to the vector is at end of file marker.
     99       to the Vector is at end of file marker.
    100100
    101101       \throw GSL_error if memory allocation fails, IO_error if
    102102       unexpected input is found in the input stream.
    103103    */
    104     explicit vector(std::istream &, char sep='\0')
     104    explicit Vector(std::istream &, char sep='\0')
    105105      throw(utility::IO_error, std::exception);
    106106
     
    108108    /// The destructor.
    109109    ///
    110     ~vector(void);
     110    ~Vector(void);
    111111
    112112    /**
     
    116116
    117117    /**
    118       \brief Resize vector
     118      \brief Resize Vector
    119119
    120120      All elements are set to \a init_value.
    121121
    122122      \note Underlying GSL vector is destroyed and a view into this
    123       vector becomes invalid.
     123      Vector becomes invalid.
    124124    */
    125125    void resize(size_t, double init_value=0);
     
    128128       \brief The assignment operator.
    129129
    130        \note Invalidates views of vector.
     130       \note Invalidates views of Vector.
    131131
    132        \return A const reference to the resulting vector.
     132       \return A const reference to the resulting Vector.
    133133    */
    134     const vector& operator=(const vector&);
     134    const Vector& operator=(const Vector&);
    135135
    136136    /**
    137137       \brief The assignment operator.
    138138
    139        \note Invalidates views of vector.
     139       \note Invalidates views of Vector.
    140140
    141        \return A const reference to the resulting vector.
     141       \return A const reference to the resulting Vector.
    142142    */
    143     const vector& operator=(const VectorBase&);
     143    const Vector& operator=(const VectorBase&);
    144144
    145145  private:
    146     const vector& assign(const VectorBase& other);
     146    const Vector& assign(const VectorBase& other);
    147147
    148148    /**
     
    163163
    164164  /**
    165      \brief Swap vector elements by copying.
     165     \brief Swap Vector elements by copying.
    166166
    167      The two vectors must have the same length.
     167     The two Vectors must have the same length.
    168168
    169      \throw GSL_error if vector lengths differs.
     169     \throw GSL_error if Vector lengths differs.
    170170  */
    171   void swap(vector&, vector&);
     171  void swap(Vector&, Vector&);
    172172
    173173}}} // of namespace utility, yat, and theplu
  • trunk/yat/utility/VectorBase.cc

    r1038 r1120  
    167167
    168168
    169   bool nan(const VectorBase& templat, vector& flag)
     169  bool nan(const VectorBase& templat, Vector& flag)
    170170  {
    171171    size_t vsize(templat.size());
    172     flag = vector(vsize, 1.0);
     172    flag = Vector(vsize, 1.0);
    173173    bool nan=false;
    174174    for (size_t i=0; i<vsize; i++)
  • trunk/yat/utility/VectorBase.h

    r1046 r1120  
    4545 
    4646  class matrix;
    47   class vector;
     47  class Vector;
    4848
    4949  /**
     
    213213     \return True if the \a templat VectorBase contains at least one NaN.
    214214  */
    215   bool nan(const VectorBase& templat, vector& flag);
     215  bool nan(const VectorBase& templat, Vector& flag);
    216216
    217217  /**
  • trunk/yat/utility/VectorMutable.h

    r1118 r1120  
    4646
    4747  class matrix;
    48   class vector;
     48  class Vector;
    4949
    5050  /**
  • trunk/yat/utility/VectorView.h

    r1118 r1120  
    4444
    4545  class matrix;
    46   class vector;
     46  class Vector;
    4747
    4848  /**
  • trunk/yat/utility/matrix.cc

    r1103 r1120  
    2525*/
    2626
    27 #include "matrix.h"
    28 #include "vector.h"
     27#include "yat/utility/matrix.h"
     28#include "yat/utility/Vector.h"
    2929#include "VectorBase.h"
    3030#include "VectorConstView.h"
     
    576576
    577577
    578   vector operator*(const matrix& m, const VectorBase& v)
    579   {
    580     utility::vector res(m.rows());
     578  Vector operator*(const matrix& m, const VectorBase& v)
     579  {
     580    utility::Vector res(m.rows());
    581581    for (size_t i=0; i<res.size(); ++i)
    582582      res(i) = VectorConstView(m,i) * v;
     
    585585
    586586
    587   vector operator*(const VectorBase& v, const matrix& m)
    588   {
    589     utility::vector res(m.columns());
     587  Vector operator*(const VectorBase& v, const matrix& m)
     588  {
     589    utility::Vector res(m.columns());
    590590    for (size_t i=0; i<res.size(); ++i)
    591591      res(i) = v * VectorConstView(m,i,false);
  • trunk/yat/utility/matrix.h

    r1103 r1120  
    3131#include "Exception.h"
    3232#include "StrideIterator.h"
    33 #include "vector.h"
     33#include "Vector.h"
    3434#include "VectorConstView.h"
    3535#include "VectorView.h"
     
    538538     \brief vector matrix multiplication
    539539   */
    540   vector operator*(const matrix&, const VectorBase&);
     540  Vector operator*(const matrix&, const VectorBase&);
    541541
    542542  /**
    543543     \brief matrix vector multiplication
    544544   */
    545   vector operator*(const VectorBase&, const matrix&);
     545  Vector operator*(const VectorBase&, const matrix&);
    546546
    547547}}} // of namespace utility, yat, and theplu
Note: See TracChangeset for help on using the changeset viewer.