Ignore:
Timestamp:
Feb 1, 2008, 5:35:32 PM (13 years ago)
Author:
Peter
Message:

changing class names vectorView => VectorView? and vectorBase => VectorBase?. Refs #256

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/VectorBase.cc

    r1013 r1015  
    2525*/
    2626
    27 #include "vectorBase.h"
     27#include "VectorBase.h"
    2828#include "matrix.h"
    2929#include "utility.h"
     
    4343
    4444
    45   vectorBase::vectorBase(void)
     45  VectorBase::VectorBase(void)
    4646    : vec_(NULL), const_vec_(NULL)
    4747  {
     
    4949
    5050
    51   vectorBase::vectorBase(gsl_vector* v)
     51  VectorBase::VectorBase(gsl_vector* v)
    5252    : vec_(v), const_vec_(v)
    5353  {
     
    5555
    5656
    57   vectorBase::vectorBase(const gsl_vector* v)
     57  VectorBase::VectorBase(const gsl_vector* v)
    5858    : vec_(NULL), const_vec_(v)
    5959  {
     
    6161
    6262
    63   vectorBase::~vectorBase(void)
    64   {
    65   }
    66 
    67 
    68   void vectorBase::all(double value)
     63  VectorBase::~VectorBase(void)
     64  {
     65  }
     66
     67
     68  void VectorBase::all(double value)
    6969  {
    7070    assert(vec_);
     
    7373
    7474
    75   vectorBase::const_iterator vectorBase::begin(void) const
     75  VectorBase::const_iterator VectorBase::begin(void) const
    7676  {
    7777    return const_iterator(*this, 0);
     
    7979
    8080
    81   vectorBase::iterator vectorBase::begin(void)
     81  VectorBase::iterator VectorBase::begin(void)
    8282  {
    8383    return iterator(*this, 0);
     
    8585
    8686
    87   void vectorBase::div(const vectorBase& other)
     87  void VectorBase::div(const VectorBase& other)
    8888  {
    8989    assert(vec_);
    9090    int status=gsl_vector_div(vec_,other.gsl_vector_p());
    9191    if (status)
    92       throw utility::GSL_error(std::string("vectorBase::div",status));
    93   }
    94 
    95 
    96   vectorBase::const_iterator vectorBase::end(void) const
     92      throw utility::GSL_error(std::string("VectorBase::div",status));
     93  }
     94
     95
     96  VectorBase::const_iterator VectorBase::end(void) const
    9797  {
    9898    return const_iterator(*this, size());
     
    100100
    101101
    102   vectorBase::iterator vectorBase::end(void)
     102  VectorBase::iterator VectorBase::end(void)
    103103  {
    104104    return iterator(*this, size());
     
    106106
    107107
    108   bool vectorBase::equal(const vectorBase& other, const double d) const
     108  bool VectorBase::equal(const VectorBase& other, const double d) const
    109109  {
    110110    if (this==&other)
     
    122122
    123123
    124   const gsl_vector* vectorBase::gsl_vector_p(void) const
     124  const gsl_vector* VectorBase::gsl_vector_p(void) const
    125125  {
    126126    return const_vec_;
     
    128128
    129129
    130   gsl_vector* vectorBase::gsl_vector_p(void)
     130  gsl_vector* VectorBase::gsl_vector_p(void)
    131131  {
    132132    return vec_;
     
    134134
    135135
    136   void vectorBase::mul(const vectorBase& other)
     136  void VectorBase::mul(const VectorBase& other)
    137137  {
    138138    assert(vec_);
    139139    int status=gsl_vector_mul(vec_,other.gsl_vector_p());
    140140    if (status)
    141       throw utility::GSL_error(std::string("vectorBase::div",status));
    142   }
    143 
    144 
    145   size_t vectorBase::size(void) const
     141      throw utility::GSL_error(std::string("VectorBase::div",status));
     142  }
     143
     144
     145  size_t VectorBase::size(void) const
    146146  {
    147147    if (!const_vec_)
     
    151151
    152152
    153   const double& vectorBase::operator()(size_t i) const
     153  const double& VectorBase::operator()(size_t i) const
    154154  {
    155155    const double* d=gsl_vector_const_ptr(const_vec_, i);
    156156    if (!d)
    157       throw utility::GSL_error("vectorBase::operator()",GSL_EINVAL);
     157      throw utility::GSL_error("VectorBase::operator()",GSL_EINVAL);
    158158    return *d;
    159159  }
    160160
    161161
    162   double& vectorBase::operator()(size_t i)
     162  double& VectorBase::operator()(size_t i)
    163163  {
    164164    double* d=gsl_vector_ptr(vec_, i);
    165165    if (!d)
    166       throw utility::GSL_error("vectorBase::operator()",GSL_EINVAL);
     166      throw utility::GSL_error("VectorBase::operator()",GSL_EINVAL);
    167167    return *d;
    168168  }
    169169
    170170
    171   double& vectorBase::operator[](size_t i)
     171  double& VectorBase::operator[](size_t i)
    172172  {
    173173    return this->operator()(i);
     
    175175
    176176
    177   const double& vectorBase::operator[](size_t i) const
     177  const double& VectorBase::operator[](size_t i) const
    178178  {
    179179    return this->operator()(i);
     
    181181
    182182
    183   bool vectorBase::operator==(const vectorBase& other) const
     183  bool VectorBase::operator==(const VectorBase& other) const
    184184  {
    185185    return equal(other);
     
    187187
    188188
    189   bool vectorBase::operator!=(const vectorBase& other) const
     189  bool VectorBase::operator!=(const VectorBase& other) const
    190190  {
    191191    return !equal(other);
     
    193193
    194194
    195   double vectorBase::operator*( const vectorBase &other ) const
     195  double VectorBase::operator*( const VectorBase &other ) const
    196196  {
    197197    double res = 0.0;;
     
    202202
    203203
    204   const vectorBase& vectorBase::operator+=(double d)
     204  const VectorBase& VectorBase::operator+=(double d)
    205205  {
    206206    assert(vec_);
     
    210210
    211211
    212   const vectorBase& vectorBase::operator-=(const vectorBase& other)
     212  const VectorBase& VectorBase::operator-=(const VectorBase& other)
    213213  {
    214214    assert(vec_);
    215215    int status=gsl_vector_sub(vec_, other.gsl_vector_p());
    216216    if (status)
    217       throw utility::GSL_error(std::string("vectorBase::sub", status));
     217      throw utility::GSL_error(std::string("VectorBase::sub", status));
    218218    return *this;
    219219  }
    220220
    221221
    222   const vectorBase& vectorBase::operator-=(const double d)
     222  const VectorBase& VectorBase::operator-=(const double d)
    223223  {
    224224    assert(vec_);
     
    228228
    229229
    230   const vectorBase& vectorBase::operator*=(double d)
     230  const VectorBase& VectorBase::operator*=(double d)
    231231  {
    232232    assert(vec_);
     
    236236
    237237
    238   bool isnull(const vectorBase& v)
     238  bool isnull(const VectorBase& v)
    239239  {
    240240    return gsl_vector_isnull(v.gsl_vector_p());
     
    242242
    243243
    244   double max(const vectorBase& v)
     244  double max(const VectorBase& v)
    245245  {
    246246    return gsl_vector_max(v.gsl_vector_p());
     
    248248
    249249
    250   size_t max_index(const vectorBase& v)
     250  size_t max_index(const VectorBase& v)
    251251  {
    252252    return gsl_vector_max_index(v.gsl_vector_p());
     
    254254
    255255
    256   double min(const vectorBase& v)
     256  double min(const VectorBase& v)
    257257  {
    258258    return gsl_vector_min(v.gsl_vector_p());
     
    260260
    261261
    262   size_t min_index(const vectorBase& v)
     262  size_t min_index(const VectorBase& v)
    263263  {
    264264    return gsl_vector_min_index(v.gsl_vector_p());
     
    266266
    267267
    268   bool nan(const vectorBase& templat, vector& flag)
     268  bool nan(const VectorBase& templat, vector& flag)
    269269  {
    270270    size_t vsize(templat.size());
     
    280280
    281281
    282   void shuffle(vectorBase& invec)
     282  void shuffle(VectorBase& invec)
    283283  {
    284284    random::DiscreteUniform rnd;
     
    287287
    288288
    289   void sort_index(std::vector<size_t>& sort_index, const vectorBase& invec)
     289  void sort_index(std::vector<size_t>& sort_index, const VectorBase& invec)
    290290  {
    291291    assert(invec.gsl_vector_p());
     
    294294    if (status) {
    295295      gsl_permutation_free(p);
    296       throw utility::GSL_error(std::string("sort_index(vector&,const vectorBase&)",status));     
     296      throw utility::GSL_error(std::string("sort_index(vector&,const VectorBase&)",status));     
    297297    }
    298298    sort_index=std::vector<size_t>(p->data,p->data+p->size);
     
    302302
    303303  void sort_smallest_index(std::vector<size_t>& sort_index, size_t k,
    304                             const vectorBase& invec)
     304                            const VectorBase& invec)
    305305  {
    306306    assert(invec.gsl_vector_p());
     
    311311 
    312312  void sort_largest_index(std::vector<size_t>& sort_index, size_t k,
    313                             const vectorBase& invec)
     313                            const VectorBase& invec)
    314314  {
    315315    assert(invec.gsl_vector_p());
     
    320320
    321321
    322   double sum(const vectorBase& v)
     322  double sum(const VectorBase& v)
    323323  {
    324324    double sum = 0;
     
    330330
    331331
    332   std::ostream& operator<<(std::ostream& s, const vectorBase& a)
     332  std::ostream& operator<<(std::ostream& s, const VectorBase& a)
    333333  {
    334334    s.setf(std::ios::dec);
Note: See TracChangeset for help on using the changeset viewer.