Changeset 1891


Ignore:
Timestamp:
Apr 2, 2009, 11:48:44 PM (12 years ago)
Author:
Peter
Message:

refs #454 - forgot the last file in r1890

File:
1 edited

Legend:

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

    r1807 r1891  
    3737#include <cmath>
    3838#include <iostream>
     39#include <stdexcept>
    3940#include <sstream>
    4041#include <vector>
     
    321322    delete_allocated_memory();
    322323
    323     assert( (r&&c) || (!r&&!c) );
    324324    if (r && c){
    325325      m_ = gsl_matrix_alloc(r,c);
    326326      if (!m_)
    327         throw utility::GSL_error("Matrix::Matrix failed to allocate memory");
     327        throw utility::GSL_error("Matrix::resize failed to allocate memory");
    328328      all(init_value);
    329329    }
     330    else if (r || c) {
     331      std::stringstream msg;
     332      msg << "Matrix::resize(" << r << ", " << c << "): incorrect dimensions\n";
     333      throw std::runtime_error(msg.str());
     334    }
     335    // This should be triggered in else if above, right?
     336    assert( (r&&c) || (!r&&!c) );
    330337
    331338    // no need to delete blas_result_ if the number of rows fit, it
Note: See TracChangeset for help on using the changeset viewer.