|[eigen] Generalized selfadjoint eigenvalues|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] Generalized selfadjoint eigenvalues
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Thu, 10 Jun 2010 10:28:40 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=M8cfE6eJ5uwG/pBovuXbZWhEHPeBcjV3z3QTefMHxUk=; b=mQ23L330SUfegWv+KVfPvCfyDedqqlnF0LMn66soweTt4DspuIOkVzczkUNrX5oFZV Hggu7F348KxCHfV9T1H23Je2vVikzRdAb//MaqgkUs0VlouUSh88p4v2l12zoWaoO3xh /sToRO50z/XKHcGZX4FU632qUtUJCwXFIu/RM=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=QFScBa07mSBYYmYqWOtsdLYcH6MXuhcSNGiwfH7Vv2niOoZk91F3uNGQhckdgn+z4c kL8DQR6dG9lhrikmHLMRmm/CUhkslTjVsWJ1hF9fw2+fZsTJQUkVu0jdr+prsXpw+k8K Nx3hO8DuowOQUntJz994jsvj4kfB6+ZgGEYn4=
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
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.