[eigen] Generalized selfadjoint eigenvalues

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]



Hi,

I have some API concerns about the generalized selfadjoint eigenvalues. Let's recall that it solves:

Ax = lambda B x

with A selfadjoint, and B SPD such that x^* B x = 1.

The current API is an overloaded ctor and compute() method in the SelfAdjointEigenSolver class taking the two matrices A and B, plus a boolean computeEigenvectors.

Here are the concerns:


1 - we might also want to offer the possibility to solve the two other variants:

BAx = lambda x
ABx = lambda x

Possible solutions:
a) add an enum parameter where possible values could be: Ax_lBx, BAx_lx, ABx_lx
b) use 3 different functions, but that does not work with the ctor.


2 - It would be nice to avoid the use of meaningless boolean for the compute* parameter. This is not specific to the generalized eigenvalue problem. Shall we introduce a ComputeEigenvectors enum though it is quite long to write? What would be the contrary? DoesNotComputeEigenvectors? definitely too verbose ! So perhaps we could have an options parameter of or-ed flags shared by all decompositions:

None = 0,
ComputeEigenvectors = 0x1,
ComputeU = 0x1,
ComputeV = 0x2,
Ax_lBx = 0x10,
BAx_lx = 0x20,
ABx_lx = 0x30,

For a generalized eigenvalue pb one would do:

eig.compute(A,B,BAx_lx | ComputeEigenvectors);


3 - Last concern: maybe it would be better to introduce a new GenSelfAdjointEigenSolver class built on top of SelfAdjointEigenSolver. Indeed, the generalized pb requires to compute (and then store) a LLT dec. Currently it is dynamically allocated in the compute function itself but it would be better to allow preallocation, but it is not good either to always preallocate it while we don't know is the user will want to solve a classic problem or a generalized one ? Then the Ax_lBx etc. could also be a template parameter of this class to (slightly) reduce code generation since it is unlikely that a user has to deal we all three possibilities.


cheers,

gael



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/