ublas - newbie question and comment
I discovered uBLAS a week ago and am very impressed by the design and implementation of the library. To learn the library I have been porting a few non-linear least squares codes from FORTRAN into uBLAS. A real hinderance is the documentation. There is no user's guide or set of example code to orient the new user to uBLAS. Some of the most valuable features are undocumented - such as scalar_vector, vector_indirect, and matrix_indirect. The widespread adoption of uBLAS by the C++ numeric community would be more rapid if these omissions were addressed. I would be willing to write up some of the *simple* examples I have done, if people think it would be useful. If my implementations can be improved, that would be even better. I'm new to Boost and haven't yet completely RTFM'd the requirements for Boost doc contributions so point me in the right direction if I'm going astray here. Having said that, I have a specific problem I'm trying to solve. I'm looking for the best "uBLAS-style" solution - I can do an element-by-element brute force solution. Problem: write the product of a diagonal matrix and a vector when the diagonal matrix is stored as a vector. So what I want to do figuratively is: int n = 5; vector<double> x(n), y(n), diag(n); diagonal_matrix<double> dMat(n); dMat = diag; x = prod(dMat, y); Is there a matrix adaptor of some sort that can fill the role of diagonal_matrix<> above? I looked in the header files and didn't see anything obvious. Thanks in adavance for your help. Mike Hayford --------------------------------- Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now [Non-text portions of this message have been removed]
I discovered uBLAS a week ago and am very impressed by the design and implementation of the library. To learn the library I have been porting a few non-linear least squares codes from FORTRAN into uBLAS. A real hinderance is the documentation. There is no user's guide or set of example code to orient
Some of the most valuable features are undocumented - such as scalar_vector, vector_indirect, and matrix_indirect. The widespread adoption of uBLAS by
----- Original Message ----- From: Mike Hayford To: Boost-Users@yahoogroups.com Sent: Tuesday, December 31, 2002 8:20 AM Subject: [Boost-Users] ublas - newbie question and comment the new user to > uBLAS. OK. the C++
numeric community would be more rapid if these omissions were addressed.
OK.
I would be willing to write up some of the *simple* examples I have done, if people think it would be useful. If my implementations can be improved, that would be even better. I'm new to Boost and haven't yet completely RTFM'd the requirements for Boost doc contributions so point me in the right direction if I'm going astray here.
Having said that, I have a specific problem I'm trying to solve. I'm looking for the best "uBLAS-style" solution - I can do an element-by-element brute force solution.
Problem: write the product of a diagonal matrix and a vector when the diagonal matrix is > stored as a vector.
So what I want to do figuratively is:
int n = 5;
vector<double> x(n), y(n), diag(n);
diagonal_matrix<double> dMat(n);
dMat = diag;
x = prod(dMat, y);
Is there a matrix adaptor of some sort that can fill the role of diagonal_matrix<> above? > I looked in the header files and didn't see anything obvious.
I'd use a banded_matrix with number of upper and lower diagonals set to zero. Another strategy could be to add an expression tree node class for this operation based on vector_binary. Regards Joerg
--- In Boost-Users@yahoogroups.com, jhr.walter@t... wrote:
----- Original Message ----- From: Mike Hayford To: Boost-Users@yahoogroups.com Sent: Tuesday, December 31, 2002 8:20 AM Subject: [Boost-Users] ublas - newbie question and comment
Problem: write the product of a diagonal matrix and a vector when
stuff clipped... the
diagonal matrix is stored as a vector.
I'd use a banded_matrix with number of upper and lower diagonals set to zero. Another strategy could be to add an expression tree node class for this operation based on vector_binary.
The banded_matrix approach is straightforward. Here's what I wound up
with:
int n = 5;
vector<double> x(n), y(n), diag(n);
banded_matrix<double> dMat(n, n, 0, 0);
matrix_vector_slice
participants (3)
-
jhr.walter@t-online.de
-
Mike Hayford
-
mikehayford <mikeh@opticalres.com>