|
Ublas : |
From: Rakesh K Sinha (rakesh_usenet_at_[hidden])
Date: 2005-01-13 08:39:29
I had posted this to the Boost Archives list sometime before. Since I did not
get any response there, I thought this list might be more appopriate and hence
am posting it here, again.
For a particular application of mine, I ned to solve the equation Ax =
B,
i.e. x = inv(A) * B
I came across the example code posted in the uBLAS documentation page.
<--------------------->
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
vector<double> v (3);
for (unsigned i = 0; i < std::min (m.size1 (), v.size ()); ++ i) {
for (unsigned j = 0; j <= i; ++ j)
m (i, j) = 3 * i + j + 1;
v (i) = i;
}
std::cout << solve (m, v, lower_tag ()) << std::endl;
}
<---------------------->
This fits my need perfectly.
Two questions though:
* Are there any other caveats with this method like it works only for
dense matrices. How does it scale to sparse matrices ?
* Also what does that lower_tag() essentially imply ? What is its
mathematical significance ?
* Is there any function to calculate the singularity of a square matrix
?
Like -
matrix<double> m (3, 3);
double det = m.determinant() ; //something like this ?
Is there any such function available in the uBLAS library. ?
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail