Ignore:
Timestamp:
Feb 17, 2007, 2:33:24 PM (15 years ago)
Author:
Jari Häkkinen
Message:

Addresses #2. Continued adding GSL_error exceptions.

File:
1 edited

Legend:

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

    r733 r753  
    66  Copyright (C) 2005 Jari Häkkinen, Peter Johansson, Markus Ringnér
    77  Copyright (C) 2006 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2007 Jari Häkkinen
    89
    910  This file is part of the yat library, http://lev.thep.lu.se/trac/yat
     
    4950      proxy_v_(v_)
    5051  {
     52    if (!v_)
     53      throw utility::GSL_error("vector::vector failed to allocate memory");
     54
    5155    set_all(init_value);
    5256  }
     
    6872    view_ = new gsl_vector_view(gsl_vector_subvector_with_stride(v.v_,offset,
    6973                                                                 stride,n));
     74    if (!view_)
     75      throw utility::GSL_error("vector::vector failed to setup view");
    7076    proxy_v_ = v_ = &(view_->vector);
    7177  }
     
    8086    view_const_ = new gsl_vector_const_view(
    8187                   gsl_vector_const_subvector_with_stride(v.v_,offset,stride,n));
     88    if (!view_const_)
     89      throw utility::GSL_error("vector::vector failed to setup view");
    8290    proxy_v_ = v_const_ = &(view_const_->vector);
    8391  }
     
    170178    // convert the data to a gsl vector
    171179    proxy_v_ = v_ = gsl_vector_alloc(nof_rows*nof_columns);
     180    if (!v_)
     181      throw utility::GSL_error("vector::vector failed to allocate memory");
    172182    size_t n=0;
    173183    for (size_t i=0; i<nof_rows; i++)
     
    203213  {
    204214    gsl_vector* vec = gsl_vector_alloc(size());
     215    if (!vec)
     216      throw utility::GSL_error("vector::create_gsl_vector_copy failed to allocate memory");
    205217    gsl_vector_memcpy(vec, proxy_v_);
    206218    return vec;
Note: See TracChangeset for help on using the changeset viewer.