Ignore:
Timestamp:
Mar 15, 2007, 9:07:01 PM (15 years ago)
Author:
Peter
Message:

previous argument was invalid, but here is an implementation. Fixes #205

File:
1 edited

Legend:

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

    r796 r808  
    55  Copyright (C) 2004 Jari Häkkinen, Peter Johansson
    66  Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    7   Copyright (C) 2007 Jari Häkkinen
     7  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    88
    99  This file is part of the yat library, http://lev.thep.lu.se/trac/yat
     
    269269
    270270
     271  void matrix::resize(size_t r, size_t c, double init_value)
     272  {
     273      if (view_)
     274        delete view_;
     275      else if (view_const_)
     276        delete view_const_;
     277      else if (m_)
     278        gsl_matrix_free(m_);
     279      proxy_m_ = m_ = gsl_matrix_alloc(r,c);
     280      if (!m_)
     281        throw utility::GSL_error("matrix::matrix failed to allocate memory");
     282      set_all(init_value);
     283
     284      // no need to delete blas_result_ if the number of rows fit, it
     285      // may be useful later.
     286      if (blas_result_ && (blas_result_->size1!=rows())) {
     287        gsl_matrix_free(blas_result_);
     288        blas_result_=NULL;
     289      }
     290  }
     291
     292
    271293  size_t matrix::rows(void) const
    272294  {
Note: See TracChangeset for help on using the changeset viewer.