Changeset 758


Ignore:
Timestamp:
Feb 19, 2007, 7:52:16 PM (17 years ago)
Author:
Jari Häkkinen
Message:

Fixes #2. Finalized adding GSL_error exceptions.

File:
1 edited

Legend:

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

    r755 r758  
    9292                              gsl_matrix_row   (m.gsl_matrix_p(),i) :
    9393                              gsl_matrix_column(m.gsl_matrix_p(),i)  );
     94    if (!view_)
     95      throw utility::GSL_error("vector::vector failed to setup view");
    9496    proxy_v_ = v_ = &(view_->vector);
    9597  }
     
    102104                                   gsl_matrix_const_row   (m.gsl_matrix_p(),i) :
    103105                                   gsl_matrix_const_column(m.gsl_matrix_p(),i) );
     106    if (!view_const_)
     107      throw utility::GSL_error("vector::vector failed to setup view");
    104108    proxy_v_ = v_const_ = &(view_const_->vector);
    105109  }
     
    403407  double& vector::operator[](size_t i)
    404408  {
    405     return *gsl_vector_ptr(v_,i);
     409    return this->operator()(i);
    406410  }
    407411
     
    409413  const double& vector::operator[](size_t i) const
    410414  {
    411     return *gsl_vector_const_ptr(proxy_v_,i);
     415    return this->operator()(i);
    412416  }
    413417
     
    417421    if (size()!=a.size())
    418422      return false;
     423    // if gsl error handler disabled, out of bounds index will not
     424    // abort the program.
    419425    for (size_t i=0; i<size(); ++i)
    420426      if (gsl_vector_get(proxy_v_,i)!=a(i))
Note: See TracChangeset for help on using the changeset viewer.