Linear algebra(Matrix, Vector and Solver) in dolfin

Asked by Xujun Zhao on 2013-04-08

I am developing my own codes on top of dolfin. Now I meet a problem:
I need to solve a linear equation: Ax = b, which is a small size equation.
In the first place, I tried to use Matrix for A and Vector for b and x, but found that it needed a TensorLayout/SparsityPatter to initialize the A before I can set the entries of A matrix, which is inconvenient.( Correct me if I were wrong! )

So I am turning to using uBLASDenseMatrix to store A and uBLASVector for b and x, in which I can declare the dense matrix as A(m,n). After assigning each entries of my matrix A and b, I would like to solve x. Here the problem comes.
I tried the following solvers:
uBLASKrylovSolver
UmfpackLUSolver
LUSolver
PETScLUSolver
...................
But none of the above solvers can give an answer. I tested that A and b have non-zero entries. However,uBLASKrylovSolver returns zeros solution, and the others just crashed down.
Can anyone give me some hints? what is the solution of my problem?

Thank you very much.
XZ

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
2013-04-08
Last reply:
2013-05-09
Anders Logg (logg) said : #1

On Mon, Apr 08, 2013 at 08:41:21PM -0000, Xujun Zhao wrote:
> Question #226223 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/226223
>
> Description changed to:
> I am developing my own codes on top of dolfin. Now I meet a problem:
> I need to solve a linear equation: Ax = b, which is a small size equation.
> In the first place, I tried to use Matrix for A and Vector for b and x, but found that it needed a TensorLayout/SparsityPatter to initialize the A before I can set the entries of A matrix, which is inconvenient.( Correct me if I were wrong! )
>
> So I am turning to using uBLASDenseMatrix to store A and uBLASVector for b and x, in which I can declare the dense matrix as A(m,n). After assigning each entries of my matrix A and b, I would like to solve x. Here the problem comes.
> I tried the following solvers:
> uBLASKrylovSolver
> UmfpackLUSolver
> LUSolver
> PETScLUSolver
> ...................
> But none of the above solvers can give an answer. I tested that A and b have non-zero entries. However,uBLASKrylovSolver returns zeros solution, and the others just crashed down.
> Can anyone give me some hints? what is the solution of my problem?
>
> Thank you very much.

It's impossible to answer that question. Your matrix may be singular.

If you want help, post a minimal code example and explain clearly what
the expected solution should be.

--
Anders

Anders Logg (logg) said : #2

FEniCS no longer uses Launchapd for Questions & Answers. Please
consult the documentation on the FEniCS web page for where and
how to (re)post your question: http://fenicsproject.org/support/

Anders Logg (logg) said : #3

FEniCS no longer uses Launchapd for Questions & Answers. Please
consult the documentation on the FEniCS web page for where and
how to (re)post your question: http://fenicsproject.org/support/

Can you help with this problem?

Provide an answer of your own, or ask Xujun Zhao for more information if necessary.

To post a message you must log in.