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

fixes #454 - throw exception when detecting funky dimensions

File:
1 edited

Legend:

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

    r1866 r1890  
    3232
    3333#include <cassert>
     34#include <stdexcept>
     35#include <sstream>
    3436#include <vector>
    3537
     
    167169  void MatrixWeighted::resize(size_t rows, size_t columns)
    168170  {
     171    if (!rows ^ !columns) { // logical xor
     172      std::stringstream msg;
     173      msg << "MatrixWeighted::resize(" << rows << ", " << columns
     174          << "): incorrect dimensions\n";
     175      throw std::runtime_error(msg.str());
     176    }
    169177    columns_ = columns;
    170178    vec_.resize(rows*columns);
Note: See TracChangeset for help on using the changeset viewer.