Boost logo

Ublas :

From: Li, Hui (Hui.Li_at_[hidden])
Date: 2008-06-24 09:21:02

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?



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;

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.