Ignore:
Timestamp:
Sep 17, 2008, 12:53:55 AM (13 years ago)
Author:
Peter
Message:

fixes #434

File:
1 edited

Legend:

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

    r1487 r1506  
    4646
    4747  Vector::Vector(size_t n, double init_value)
    48     : VectorMutable(gsl_vector_alloc(n))
    49   {
    50     if (!vec_)
    51       throw utility::GSL_error("Vector::Vector failed to allocate memory");
    52     assert(const_vec_);
    53     all(init_value);
     48    : VectorMutable(create_gsl_vector(n))
     49  {
     50    if (n)
     51      all(init_value);
     52    assert(n==0 || vec_);
     53    assert(n==0 || const_vec_);
    5454  }
    5555
     
    204204
    205205
     206  gsl_vector* Vector::create_gsl_vector(size_t n) const
     207  {
     208    if (!n)
     209      return NULL;
     210    gsl_vector* vec = gsl_vector_alloc(n);
     211    if (!vec)
     212      throw utility::GSL_error("Vector::create_gsl_vector failed to allocate memory");
     213    return vec;
     214  }
     215
     216
    206217  void Vector::delete_allocated_memory(void)
    207218  {
Note: See TracChangeset for help on using the changeset viewer.