Ignore:
Timestamp:
Mar 2, 2007, 12:53:03 AM (15 years ago)
Author:
Jari Häkkinen
Message:

Fixes #200.

File:
1 edited

Legend:

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

    r759 r775  
    198198
    199199
    200   void vector::add(const vector& other)
    201   {
    202     int status=gsl_vector_add(v_,other.v_);
    203     if (status)
    204       throw utility::GSL_error(std::string("vector::add",status));
    205   }
    206 
    207 
    208   void vector::add(double term)
    209   {
    210     gsl_vector_add_constant(v_,term);
    211   }
    212 
    213 
    214200  gsl_vector* vector::create_gsl_vector_copy(void) const
    215201  {
     
    309295
    310296
    311   void vector::scale(double factor)
    312   {
    313     gsl_vector_scale(v_,factor);
    314   }
    315 
    316 
    317297  void vector::set(const vector& vec)
    318298  {
     
    351331  {
    352332    gsl_sort_vector(v_);
    353   }
    354 
    355 
    356   void vector::sub(const vector& other)
    357   {
    358     int status=gsl_vector_sub(v_,other.v_);
    359     if (status)
    360       throw utility::GSL_error(std::string("vector::sub",status));
    361333  }
    362334
     
    457429  const vector& vector::operator+=(const vector& other)
    458430  {
    459     add(other);
     431    int status=gsl_vector_add(v_,other. v_);
     432    if (status)
     433      throw utility::GSL_error(std::string("vector::add", status));
    460434    return *this;
    461435  }
    462436
    463437
     438  const vector& vector::operator+=(double d)
     439  {
     440    gsl_vector_add_constant(v_, d);
     441    return *this;
     442  }
     443
     444
    464445  const vector& vector::operator-=(const vector& other)
    465446  {
    466     sub(other);
     447    int status=gsl_vector_sub(v_, other.v_);
     448    if (status)
     449      throw utility::GSL_error(std::string("vector::sub", status));
    467450    return *this;
    468451  }
     
    471454  const vector& vector::operator*=(const double d)
    472455  {
    473     scale(d);
     456    gsl_vector_scale(v_, d);
    474457    return *this;
    475458  }
Note: See TracChangeset for help on using the changeset viewer.