using ublas to solve linear systems?
I'm trying to see if I can use ublas to solve a linear system of equations. Digging through the documentation, I find a description of a function called 'solve" that says "Solves a linear equation for a triangular matrix." There is also a formula, B = solve(A, B, tag) <------> B <- A-1 B But I just don't know what any of this means (even though I am a mathematician and quite fluent in linear algebra). So a) can ublas be used (without me implementing any additional algorithms) to solve a linear system of equations? b) what exactly does the function solve do?
--- In Boost-Users@y..., "deane_yang"
I'm trying to see if I can use ublas to solve a linear system of equations.
Yes, you can use it to write a lu factorization, for example.
Digging through the documentation, I find a description of a function called 'solve" that says "Solves a linear equation for a triangular matrix." There is also a formula,
B = solve(A, B, tag) <------> B <- A-1 B
At least the -1 is superscripted in the HTML docs, meaning the inverse of the matrix AFAIK.
But I just don't know what any of this means (even though I am a mathematician and quite fluent in linear algebra).
So a) can ublas be used (without me implementing any additional algorithms) to solve a linear system of equations?
No.
b) what exactly does the function solve do?
It's the usual BLAS (see for example www.netlib.org/blas) triangular solver (sorry for the repetition) used in the forward/backsubstitution step of lu for example. Best regards Joerg
--- In Boost-Users@y..., "jhrwalter"
--- In Boost-Users@y..., "deane_yang"
wrote: Digging through the documentation, I find a description of a function called 'solve" that says "Solves a linear equation for a triangular matrix." There is also a formula,
B = solve(A, B, tag) <------> B <- A-1 B
At least the -1 is superscripted in the HTML docs, meaning the inverse of the matrix AFAIK.
Yes, I knew that. That still does not make anything clear. For example, why is B on both sides of the assignment operator? Does this imply that "B = solve(A,B, tag)" causes B to be replaced by A^{-1}B? Is this the only valid way to use "solve"? And where does "triangular" come into all of this?
b) what exactly does the function solve do?
It's the usual BLAS (see for example www.netlib.org/blas) triangular solver (sorry for the repetition) used in the forward/backsubstitution step of lu for example.
Best regards
Joerg
I can infer from what you say that in fact the matrix A above needs to be triangular. It would be clearer, if that were made explicit in the documentation. And is it standard lingo in some circles to say "solve for a triangular matrix" for the act of replacing a vector or matrix B by A^{-1}B, where A is triangular? I find this odd, since when I say "solve for <something>", I mean that <something> is an unknown object that needs to be found through a calculation. Here, the triangular matrix is known, so it does not need to be solved for. The unknown is in fact either a vector or a matrix that does not need to be triangular at all. I would suggest that the documentation for uBLAS is quite inadequate for someone who is not fluent in BLAS. Is the intent to have uBLAS only usable by people who are fluent in BLAS? Couldn't the documentation for uBLAS be a little more precise and use less shorthand BLAS lingo? Regards, Deane
----- Original Message ----- From: deane_yang To: Boost-Users@yahoogroups.com Sent: Sunday, November 10, 2002 11:52 PM Subject: [Boost-Users] Re: using ublas to solve linear systems?
--- In Boost-Users@y..., "jhrwalter"
wrote: --- In Boost-Users@y..., "deane_yang"
wrote: Digging through the documentation, I find a description of a function called 'solve" that says "Solves a linear equation for a triangular matrix." There is also a formula,
B = solve(A, B, tag) <------> B <- A-1 B
At least the -1 is superscripted in the HTML docs, meaning the inverse of the matrix AFAIK.
Yes, I knew that. That still does not make anything clear. For example, why is B on both sides of the assignment operator? Does this imply that "B = solve(A,B, tag)" causes B to be replaced by A^{-1}B?
Oops. I've just looked into the sources (always recommended ;-) and noticed that this is a documentation bug. The corrected documentation should read C = solve(A, B, tag) <------> C <- A^-1 B Corresponding inplace "solvers" are used internally: inplace_solve(A, B, ...) <------> B <- A^-1 B Maybe I should add an appropriate dispatcher function and document it, too.
Is this the only valid way to use "solve"?
And where does "triangular" come into all of this?
A has to be triangular (I'll add this, if it's not there already).
b) what exactly does the function solve do?
It's the usual BLAS (see for example www.netlib.org/blas) triangular solver (sorry for the repetition) used in the forward/backsubstitution step of lu for example.
I can infer from what you say that in fact the matrix A above needs to be triangular. It would be clearer, if that were made explicit in the documentation.
Agreed.
And is it standard lingo in some circles to say "solve for a triangular matrix" for the act of replacing a vector or matrix B by A^{-1}B, where A is triangular? I find this odd, since when I say "solve for <something>", I mean that <something> is an unknown object that needs to be found through a calculation.
Sorry, I'm not a native speaker. How would you correct this?
Here, the triangular matrix is known, so it does not need to be solved for. The unknown is in fact either a vector or a matrix that does not need to be triangular at all.
I would suggest that the documentation for uBLAS is quite inadequate for someone who is not fluent in BLAS.
Before I started, I wasn't fluent in BLAS. Seems to be the force of habit.
Is the intent to have uBLAS only usable by people who are fluent in BLAS?
No. But it's certainly intent to point to BLAS.
Couldn't the documentation for uBLAS be a little more precise and use less shorthand BLAS lingo?
If time and competence allow. Thanks for your feedback Joerg
Thanks for the helpful reply! I just have a few more comments and questions.
For example, why is B on both sides of the assignment operator? Does this imply that "B = solve(A,B, tag)" causes B to be replaced by A^{-1}B?
Oops. I've just looked into the sources (always recommended ;-) and noticed that this is a documentation bug. The corrected documentation should read
C = solve(A, B, tag) <------> C <- A^-1 B
Corresponding inplace "solvers" are used internally:
inplace_solve(A, B, ...) <------> B <- A^-1 B
Maybe I should add an appropriate dispatcher function and document it, too.
I'm not sure what this means, but having the in-place solver available publicly sounds like a good idea.
And is it standard lingo in some circles to say "solve for a triangular matrix" for the act of replacing a vector or matrix B by A^{-1}B, where A is triangular? I find this odd, since when I say "solve for <something>", I mean that <something> is an unknown object that needs to be found through a calculation.
Sorry, I'm not a native speaker. How would you correct this?
This is, I admit, a little tricky. The best I can come up with is "solve a triangular system of equations" or "invert a triangular matrix". Deane
participants (3)
-
deane_yang
-
jhr.walter@t-online.de
-
jhrwalter