# Linear algebra(Matrix, Vector and Solver) in dolfin

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/

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,

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:/

>

> 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/

>

> 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,

> 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://

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://

## Can you help with this problem?

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