 Timestamp:
 Oct 24, 2008, 11:12:37 PM (13 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/yat/utility/Matrix.cc
r1487 r1598 49 49 50 50 Matrix::Matrix(const size_t& r, const size_t& c, double init_value) 51 : blas_result_(NULL), m_(gsl_matrix_alloc(r,c)) 52 { 53 if (!m_) 54 throw utility::GSL_error("Matrix::Matrix failed to allocate memory"); 55 all(init_value); 51 : blas_result_(NULL), m_(NULL) 52 { 53 resize(r,c,init_value); 56 54 } 57 55 … … 217 215 gsl_matrix* Matrix::create_gsl_matrix_copy(void) const 218 216 { 217 if (!m_) 218 return NULL; 219 219 gsl_matrix* m = gsl_matrix_alloc(rows(),columns()); 220 220 if (!m) … … 441 441 const Matrix& Matrix::operator=( const Matrix& other ) 442 442 { 443 assert(other.m_);444 443 if (this!=&other) { 445 if ( !m_  (other.m_>size1!=m_>size1)  (other.m_>size2!=m_>size2) ) 446 resize(other.m_>size1,other.m_>size2); 447 if (gsl_matrix_memcpy(m_, other.gsl_matrix_p())) 448 throw utility::GSL_error("Matrix::create_gsl_matrix_copy dimension mismatch"); 444 if (rows()!=other.rows()  columns()!=other.columns()) 445 resize(other.rows(), other.columns()); 446 447 if (m_) 448 if (gsl_matrix_memcpy(m_, other.gsl_matrix_p())) { 449 std::string s="Matrix::create_gsl_matrix_copy dimension mismatch"; 450 throw utility::GSL_error(s); 451 } 449 452 } 450 453 return *this;
Note: See TracChangeset
for help on using the changeset viewer.