I didn’t find any specification on whether a ublas::triangular_matrix must be a square matrix, i.e., the number of row and the number of columns must be the
same.
In the document, it specifies what it means by a square matrix being triangular. But mathematically, triangular matrices don’t have to be square, e.g., an upper
triangular can be any shape as long as its elements below the diagonal are all zeros.
For the program that I’m working on, I really need to know for sure that ublas does or does not assume a square shape of triangular matrices, even though my
test (attached) does give the correct results, which seems to suggest that it does not assume a square triangular matrix.
On another different note, I got error when trying to fill a triangular_matrix with std::fill (please see the part in the test that’s commented out). Can anyone
explain why?
Thanks!
Hui
triangular_matrix<double,upper> upmat(3,5);
for ( size_t i = 0; i < 3; ++i )
for ( size_t j = i; j < 5; ++j )
upmat(i,j) = 0;
// fill(upmat.begin1(),upmat.end1(),0); // this gives bad_index exception
upmat(0,4) = 3;
cout << upmat << endl;