I have an identity matrix that when initialized with the constructor I don't get an error.  If I do a default construction and then resize the matrix I get a runtime error.  I'm not sure the difference.  Could someone enlighten me?
 
Ryan
 
using namespace boost::numeric::ublas;
 
template<typename matrixT>
matrix_range<matrixT> topleft (matrixT & M) { return subrange(M, 0, 3, 0, 3); }
 
int main(int, char const* []) {
  vector<double> initial(3);
  initial[0] = 10;
  initial[0] = 100;
  initial[0] = 2;
 
  //I realize that "matrix<double> P(zero_matrix<double>(9,9));" would do the same thing as below.
  //This is extracted from a class and the constructor needs to to this.
  matrix<double> P;  //This is a class variable
  P.resize(9,9);     //This happens in the constructor
  P.clear();         //This happens in the constructor
 
  //The following runs without errors
  //identity_matrix<double> identity(3);
 
  //This causes a run time error.
  identity_matrix<double> identity;
  identity.resize(3);
 
  topleft(P) = initial[0] * identity;
 
  return 0;
}