Changeset 1147


Ignore:
Timestamp:
Feb 25, 2008, 10:24:40 PM (16 years ago)
Author:
Peter
Message:

fixes #294

Location:
trunk/yat/utility
Files:
2 edited

Legend:

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

    r1121 r1147  
    7070    : blas_result_(NULL)
    7171  {
     72    if (!is.good())
     73      throw utility::IO_error("Matrix: istream is not good");
     74
    7275    // read the data file and store in stl vectors (dynamically
    7376    // expandable)
     
    123126    // manipulate the state of the stream to be good
    124127    is.clear(std::ios::goodbit);
     128   
     129    // if stream was empty, create nothing
     130    if (!nof_columns || !nof_rows)
     131      return;
     132
    125133    // convert the data to a gsl matrix
    126134    m_ = gsl_matrix_alloc ( nof_rows, nof_columns );
  • trunk/yat/utility/Vector.cc

    r1136 r1147  
    7474    : VectorMutable()
    7575  {
     76    if (!is.good())
     77      throw utility::IO_error("Vector: istream is not good");
     78
    7679    // read the data file and store in stl vectors (dynamically
    7780    // expandable)
     
    134137    // manipulate the state of the stream to be good
    135138    is.clear(std::ios::goodbit);
     139
     140    if (!nof_columns || !nof_rows)
     141      return;
     142
    136143    // convert the data to a gsl vector
    137144    vec_ = gsl_vector_alloc(nof_rows*nof_columns);
Note: See TracChangeset for help on using the changeset viewer.