Run time error while trying to insert element in a matrix with size not specified initially.
The below code runs finr for m1 but throws error for m2.
#include <iostream>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
boost::numeric::ublas::matrix<double> m1 (1,1);
boost::numeric::ublas::matrix<double> m2;
unsigned int i = 0;
m1(i,i)=9; // This works completely
m2(i,i)=9; // This one throws error
return 0;
}
If someone can provide an alternative to achieve this, i shall be highly grateful.