Changeset 1130 for trunk/yat


Ignore:
Timestamp:
Feb 23, 2008, 7:49:29 PM (13 years ago)
Author:
Peter
Message:

some docs and fixed bug in VectorConstView?

Location:
trunk/yat/utility
Files:
4 edited

Legend:

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

    r1129 r1130  
    162162      if (!vec_)
    163163        throw utility::GSL_error("Vector failed to allocate memory");
    164       gsl_vector_memcpy(vec_,other.gsl_vector_p());
     164      if (gsl_vector_memcpy(vec_, other.gsl_vector_p()))
     165        throw utility::GSL_error("Vector::assign memcpy failed.");
    165166      const_vec_ = vec_;
    166167    }
  • trunk/yat/utility/VectorConstView.cc

    r1121 r1130  
    3434
    3535  VectorConstView::VectorConstView(const VectorConstView& other)
    36     : VectorBase(other.gsl_vector_p()), const_view_(NULL)
     36    : VectorBase(), const_view_(NULL)
    3737  {
     38    const_view_ =
     39      new gsl_vector_const_view(gsl_vector_const_subvector(other.gsl_vector_p(),
     40                                                           0, other.size()));
     41    const_vec_ = &(const_view_->vector);
    3842  }
    3943
    4044
    4145  VectorConstView::VectorConstView(const VectorBase& other)
    42     : VectorBase(other.gsl_vector_p()), const_view_(NULL)
     46    : VectorBase(), const_view_(NULL)
    4347  {
     48    const_view_ =
     49      new gsl_vector_const_view(gsl_vector_const_subvector(other.gsl_vector_p(),
     50                                                           0, other.size()));
     51    const_vec_ = &(const_view_->vector);
    4452  }
    4553
  • trunk/yat/utility/VectorView.cc

    r1121 r1130  
    103103  {
    104104    if (size()!=other.size())
    105       throw utility::GSL_error("VectorView::dimension mis-match");
     105      throw utility::GSL_error("VectorView::assign dimension mis-match");
    106106    if (!other.size())
    107107      return *this;
    108     gsl_vector_memcpy(vec_, other.gsl_vector_p());
     108    if (gsl_vector_memcpy(vec_, other.gsl_vector_p()))
     109      throw utility::GSL_error("VectorView::assign memcpy failed.");
    109110    const_vec_ = vec_;
    110111    return *this;
  • trunk/yat/utility/VectorView.h

    r1121 r1130  
    9090       \brief Default constructor.
    9191
    92        Creates a view into nothing and behaves like an empty vector.
     92       Creates a view into nothing and behaves like an empty Vector.
    9393    */
    9494    VectorView(void);
     
    122122       deleted, the view becomes invalid and the result of further use
    123123       is undefined.
    124 
    125        \throw GSL_error if a view cannot be set up.
    126124    */
    127125    VectorView(VectorMutable& v, size_t offset, size_t n, size_t stride=1);
     
    168166       \note modifies underlying data.
    169167
    170        \throw GSL_error if dimensions mis-match.
     168       \throw GSL_error if dimensions mis-match or if assignment fails
    171169    */
    172170    const VectorView& operator=(const VectorView&);
     
    179177       \note modifies underlying data.
    180178
    181        \throw GSL_error if dimensions mis-match.
     179       \throw GSL_error if dimensions mis-match or if assignment fails
    182180    */
    183181    const VectorView& operator=(const VectorBase&);
Note: See TracChangeset for help on using the changeset viewer.