I want to use FEniCS' toolkit to solve linear systems created in scipy

Asked by Sergey Alyaev

For solving la FEniCS uses all the best libraries and I would like to utilize its abilities.
There is not a lot of documentation/examples of creating petsc matices by hand and I would like to make one.

Is there a way to convert scypy sparse matrix to petsc sparse matrix?
And to convert corresponding numpy vectors there and back?

Which solve() should I use to solve non-symmetric linear system?

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Kent-Andre Mardal (kent-and) said :
#1

On 13 October 2011 16:05, Sergey Alyaev <
<email address hidden>> wrote:

> New question #174145 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/174145
>
> For solving la FEniCS uses all the best libraries and I would like to
> utilize its abilities.
> There is not a lot of documentation/examples of creating petsc matices by
> hand and I would like to make one.
>
> Is there a way to convert scypy sparse matrix to petsc sparse matrix?
> And to convert corresponding numpy vectors there and back?
>
> Which solve() should I use to solve non-symmetric linear system?
>
>
You can use the array functions and slices. You should also have a look at
PyAMG which employs
both scipy and dolfin.
http://code.google.com/p/pyamg/

Kent

> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>

Revision history for this message
Sergey Alyaev (cobxo3bot) said :
#2

I cannot manage to use the add method of matrices because I cannot determine how to emulate:

type 'std::vector< std::vector< dolfin::uint > > const &'
from python.

class dolfin.cpp.GenericMatrix(*args, **kwargs)
add(block, rows)

Revision history for this message
Kent-Andre Mardal (kent-and) said :
#3

If you want to add together matrices you should use the underlying matrices
in e.g. PETSc or Epetra.
Or you can emply cbc.block (https://launchpad.net/cbc.block) which relies on
Epetra.

The add function in Matrix is for adding small dense blocks. This is used
during assembly.

Kent

On 13 October 2011 19:00, Sergey Alyaev <
<email address hidden>> wrote:

> Question #174145 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/174145
>
> Status: Answered => Open
>
> Sergey Alyaev is still having a problem:
> I cannot manage to use the add method of matrices because I cannot
> determine how to emulate:
>
> type 'std::vector< std::vector< dolfin::uint > > const &'
> from python.
>
> class dolfin.cpp.GenericMatrix(*args, **kwargs)
> add(block, rows)
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>

Can you help with this problem?

Provide an answer of your own, or ask Sergey Alyaev for more information if necessary.

To post a message you must log in.