Dear Anna,
> I am new to deal.ii
>
Welcome to the deal.II community!
> when using LinearOperators I am not actually constructing the matrix, but
> only know how such matrix would act on a vector. Am I correct?
>
Yes, thats exactly correct.
> Could you please let me know whether I will be able to invert the matrix
> constructed by LinearOperators with a direct solver, or it would only be
> possible to use iterative solver.
>
No, you would not be able to use a direct solver to invert this matrix,
since a direct solver needs access to the actual entries in the matrix to
do, for example, LU decomposition.
If you will be using a direct solver then it would seem then that
SparseMatrixEZ is the indeed best suited to your needs for now. Either
that, or you could also (maybe) do the initialisation of the block sparse
matrix manually, something like this:
BlockDynamicSparsityPattern dsp (2, 2);
dsp.block (0, 0).reinit (n_E_re, n_E_re);
dsp.block (1, 0).reinit (n_E_im, n_E_re);
dsp.block (0, 1).reinit (n_E_re, n_E_im);
dsp.block (1, 1).reinit (n_E_im, n_E_im);
dsp.collect_sizes ();
DoFTools::make_sparsity_pattern (dof_handler, dsp, constraints,
false);
sparsity_pattern.copy_from (dsp);
// Initialise all blocks of system matrix
BlockSparseMatrix<double> system_matrix;
system_matrix.reinit(sparsity_pattern);
// Redo initialisation of some sublocks of the matrix
// This should make the internal pointer to the sparsity pattern point to
the same entity
system_matrix.block(0,0).reinit(sparsity_pattern.block(0,0));
system_matrix.block(1,0).reinit(sparsity_pattern.block(0,0));
system_matrix.block(0,1).reinit(sparsity_pattern.block(0,0));
system_matrix.block(1,1).reinit(sparsity_pattern.block(0,0));
Maybe there is a better way for us to check the compatibility of two sparse
matrices when performing additive operations with them, but this would
likely mean checking that the stencils are exactly the same, which would in
general be an expensive operation that we'd prefer to avoid.
J-P
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.