Re: [eigen] Using LU with matrix-views and blocks

[ Thread Index | Date Index | More Archives ]

2010/4/11 Manoj Rajagopalan <rmanoj@xxxxxxxxx>:
> Hi eigen-users,
>   I have a requirement for performing A \ b where A is a submatrix of a
> larger matrix, created using MatrixXd::block(...). I can use
> but can't seem to be able to use FullPivLu<Block<MatrixXd> > to store the LU
> factorization of A and then use it repeatedly. Is this be design?

Why don't you just do:

  FullPivLU<MatrixXd> lu(matrix.block(....));

That does what I understand you describe above. Or are you looking for
an in-place decomposition (i.e. you want to avoid the cost of a matrix
copy)? It's true that we don't do in-place LU at the moment. It is

>  I also don't seem to be able to store the LU factorization when I create a
> matrix view using Map<MatrixXd>.

Same: FullPivLU<MatrixXd> lu(some_map_object);

>   I am writing code that needs to be high-performance so I conservatively
> pre-allocate my matrices in a constructor and later use submatrix portions
> later (whose dimensions show bounded change with each iteration).
> Alternatively, I conservatively pre-allocate a large std::vector<double> in
> my CTOR and try to use Map<MatrixXd> with the correct dynamic size. In either
> case, I need to use the LU.

OK, so you really want in-place LU and/or preallocation, sorry we
don't support that at the moment though it is not hard to adapt Eigen
for that. There have been threads recently on this list on these

>   Problems mostly seem to be venial compilation issues:
> 1. missing enums
> 2. missing default CTORs for Block and Map (probably by design)
> 3. DenseStorageBase::_check_template_params() failure because correcting
>    issue #1 above with missing enum defs fails static assert (probably
>    because I don't understand Eigen well enough yet to assign correct
>    values).
>  Any ideas/tips?

Sorry, it's a bit complicated to explain here by e-mail exactly how to
code this feature. If you have precise questions though, i'll be happy
to help.


Mail converted by MHonArc 2.6.19+