Bumi

Joined 4 March 2016
5,102 bytes added ,  25 March 2016
m (→‎GSoC 2016 application: Implementation added)
Line 129: Line 129:


=== Implementation ===
=== Implementation ===
==== Preliminary balancing ====
* In Octave currently the preliminary balancing is not done in eig, while in Matlab the balancing is default and it can be turned out by 'nobalance'. (In the standard eigenvalue problem)
* The ability to turn off the balancing is important as:
Balancing can destroy the properties of certain matrices; use it with some care. If a matrix contains small elements that are due to roundoff error, balancing might scale them up to make them as significant as the other elements of  the original matrix. [http://www.mathworks.com/help/matlab/ref/balance.html]
* Syntax of preliminary balancing in Matlab:
[___] = eig(A,balanceOption)
* Where the default for balanceOption is 'balance' and it can be changed to 'nobalance':
[http://www.mathworks.com/help/matlab/ref/eig.html?refresh=true#inputarg_balanceOption balanceOption] — Balance option
  'balance' (default) | 'nobalance'
* In Octave currently the *geev LAPACK function is used. Using the extended *geevx function instead would allow to enable balancing. It not just allows 'balance' and 'nobalance' option it provides 4 modes:
BALANC is CHARACTER*1
Specifies the balance option to be performed.
= 'N':  do not diagonally scale or permute;
= 'P':  permute only;
= 'S':  scale only;
= 'B':  both permute and scale.
Computed reciprocal condition numbers will be for the
matrices after permuting and/or balancing. Permuting does
not change condition numbers (in exact arithmetic), but
balancing does.
* The Matlab documentation does not mention whether there is balancing in the generalised case, but if needed the *ggevx could be used same.
==== Computing left eigenvectors as a third output ====
* *geevx and *ggeevx could also be used as these can compute not just right but left eigenvalues also.
==== Choosing among generalized eigenvalue algorithms ====
* Octave:
The algorithm used depends on whether there are one or two input matrices, if they are real or complex, and if they are symmetric (Hermitian if complex) or non-symmetric.[http://octave.sourceforge.net/octave/function/eig.html]
* Currently in Octave the algorithm used is the same as in Matlab. It uses the Cholesky factorization if the matrices are symmetric otherwise it uses the QZ algorithm. But in Matlab the user can decide the algorithm directly:
[___] = eig(A,B,algorithm)
* Where the algorithm can be 'chol' or 'qz'
[http://www.mathworks.com/help/matlab/ref/eig.html?refresh=true#inputarg_algorithm algorithm] — Generalized eigenvalue algorithm
'chol' | 'qz'
* But if A or B are not symmetric than it still uses the QZ algorithm
==== Choosing among return value formats of the eigenvalues ====
* The default return value format is the same in Matlab as in Octave:
If you specify one output, such as e = eig(A), then the eigenvalues are returned as a column vector by default.
If you specify two or three outputs, such as [V,D] = eig(A), then the eigenvalues are returned as a diagonal matrix, D, by default. [http://www.mathworks.com/help/matlab/ref/eig.html#inputarg_eigvalOption]
* But in Matlab the default can be changed.
[___] = eig(___,eigvalOption)
* Where eigvalOption can be 'vector' or 'matrix'
[http://www.mathworks.com/help/matlab/ref/eig.html?refresh=true#inputarg_eigvalOption eigvalOption] — Eigenvalue option
'vector' | 'matrix'
==== LAPACK routines ====
{| class="wikitable"
! colspan="2" | List of some useful LAPACK routines
|-
| [http://www.netlib.org/lapack/explore-html/d9/d8e/group__double_g_eeigen.html#ga4e35e1d4e9b63ba9eef4ba8aff3debae dgeevx]
| rowspan="2" | Computing right and left eigenvectors, optionally eigenvalues, with balance option
|-
| [http://www.netlib.org/lapack/explore-html/db/d55/group__complex16_g_eeigen.html#gae55acf82651540f7d8f36715eec0900d zgeevx]
|-
| [http://www.netlib.org/lapack/explore-html/d9/d8e/group__double_g_eeigen.html#ga58099bb0f4ebe6a1f6f6078e05a6fb78 dggevx]
| rowspan="2" | Computing generialized eigenvalues, optionally right and left generalised eigenvectors, with balance option
|-
| [http://www.netlib.org/lapack/explore-html/db/d55/group__complex16_g_eeigen.html#gaad769423756706f1186027c9dd7615e4 zggevx]
|-
| [http://www.netlib.org/lapack/explore-html/d2/d8a/group__double_s_yeigen.html#ga442c43fca5493590f8f26cf42fed4044 dsyev]
| rowspan="2" | Computing all eigenvalues, optionally eigenvectors for Hermitan/Symmetric matrix
|-
| [http://www.netlib.org/lapack/explore-html/d6/dee/zheev_8f.html#af23fb5b3ae38072ef4890ba43d5cfea2 zheev]
|-
| [http://www.netlib.org/lapack/explore-html/d2/d8a/group__double_s_yeigen.html#ga007d33bcdcc697e17c6d15432f159b73 dsygv]
| rowspan="2" | Generalised
|-
| [http://www.netlib.org/lapack/explore-html/dd/de2/zhegv_8f.html#af7b790b3b89de432a423c9006c1cc1ac zhegv]
|-
| [http://www.netlib.org/lapack/explore-html/d1/d7a/group__double_p_ocomputational.html#ga2f55f604a6003d03b5cd4a0adcfb74d6 dpotrf]
| rowspan="2" | For Cholesky factorization
|-
| [http://www.netlib.org/lapack/explore-html/da/d7a/_v_a_r_i_a_n_t_s_2cholesky_2_r_l_2zpotrf_8f.html#a93e22b682170873efb50df5a79c5e4eb zpotrf]
|}
14

edits