Changeset 1172


Ignore:
Timestamp:
Feb 27, 2008, 3:32:15 PM (16 years ago)
Author:
Peter
Message:

allowing resize to zero size. In Matrix if resize is called with only one of columns or rows set to zero a zero by zero matrix is created. I think we can live with that. Though an assertion is called because it is strange.

Location:
trunk/yat/utility
Files:
2 edited

Legend:

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

    r1147 r1172  
    320320    delete_allocated_memory();
    321321
    322     m_ = gsl_matrix_alloc(r,c);
    323     if (!m_)
    324       throw utility::GSL_error("Matrix::Matrix failed to allocate memory");
    325     all(init_value);
     322    assert( (r&&c) || (!r&&!c) );
     323    if (r && c){
     324      m_ = gsl_matrix_alloc(r,c);
     325      if (!m_)
     326        throw utility::GSL_error("Matrix::Matrix failed to allocate memory");
     327      all(init_value);
     328    }
    326329
    327330    // no need to delete blas_result_ if the number of rows fit, it
  • trunk/yat/utility/Vector.cc

    r1147 r1172  
    220220  {
    221221    delete_allocated_memory();
     222    if (!n)
     223      return;
    222224    const_vec_ = vec_ = gsl_vector_alloc(n);
    223225    if (!vec_)
Note: See TracChangeset for help on using the changeset viewer.