User:Bumi: Difference between revisions

Jump to navigation Jump to search
7,234 bytes added ,  27 June 2016
m
m (→‎GSoC 2016 application: correct typo, delete "?")
 
(11 intermediate revisions by the same user not shown)
Line 33: Line 33:
* Please state the commits and patches you already contributed to Octave.
* Please state the commits and patches you already contributed to Octave.
** [https://savannah.gnu.org/bugs/?36437 bug #36437]
** [https://savannah.gnu.org/bugs/?36437 bug #36437]
** '''Currently I am working on [http://wiki.octave.org/User:Bumi#Preliminary_balancing Preliminary balancing]'''
*** '''[https://savannah.gnu.org/patch/?8960 patch #8960]'''
*** [http://pastebin.com/CBBUYYDW EIG.cc]
*** [http://pastebin.com/9met8n18 EIG.h]
*** [http://pastebin.com/9PZLTd48 fEIG.cc]
*** [http://pastebin.com/Z6RifG2i fEIG.h]
*** [http://pastebin.com/RJ6Fi04f eig.cc]
*** And I also created a diff file
****  [http://pastebin.com/C7PhbzVS diff]


== F: Feeling fine ==
== F: Feeling fine ==
Line 79: Line 88:
* Please provide a rough estimated timeline for your work on the task.
* Please provide a rough estimated timeline for your work on the task.


=== Project goals===
I chose the '''[http://wiki.octave.org/Summer_of_Code_Project_Ideas#Generalised_eigenvalue_problem Generalised eigenvalue problem]'''.
I chose the '''[http://wiki.octave.org/Summer_of_Code_Project_Ideas#Generalised_eigenvalue_problem Generalised eigenvalue problem]'''.


Line 85: Line 95:
* computing left eigenvectors as a third output
* computing left eigenvectors as a third output
* choosing among generalized eigenvalue algorithms
* choosing among generalized eigenvalue algorithms
* choosing among return value format of the eigenvalues (vector or matrix) see more [http://www.mathworks.com/help/matlab/ref/eig.html here.]
* choosing among return value formats of the eigenvalues (vector or matrix) see more [http://www.mathworks.com/help/matlab/ref/eig.html here.]
The project's aim is to implement these functionalities.
The project's aim is to implement these functionalities.
{| class="wikitable"
{| class="wikitable"
Line 110: Line 120:
=== Timeline ===
=== Timeline ===
* '''Community Bonding period''' (Until May 22)
* '''Community Bonding period''' (Until May 22)
** Get acquainted with the code and LAPACK
** Get acquainted with the code and LAPACK, <u>finish most of  preliminary balancing</u>
* '''Week 1-2''' (May 23 - Jun 5)
* '''Week 1-2''' (May 23 - Jun 5)
** Finals, non-coding time
** Finals, non-coding time
Line 118: Line 128:
* '''Midterm evaluations''' (Jun 20 - Jun 27)
* '''Midterm evaluations''' (Jun 20 - Jun 27)
* '''Week 6''' (Jun 27 - Jul 3)
* '''Week 6''' (Jun 27 - Jul 3)
** Implementing preliminary balancing, testing
** <s>Implementing preliminary balancing, testing</s>
* '''Week 7-10''' (Jul 4 - Jul 31)
* '''Week 7-10''' (Jul 4 - Jul 31)
** algorithm choosing for eigenvalue calculation (chol or qz)
** algorithm choosing for eigenvalue calculation (chol or qz)
Line 127: Line 137:
** deciding return value format of the eigenvalues (vector or matrix)  
** deciding return value format of the eigenvalues (vector or matrix)  
** testing, documenting
** testing, documenting
=== 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.
** '''EDIT:''' In Matlab there is no balance option in the generalised case:
* IN:
{{Code|Matlab's eig|<syntaxhighlight lang="matlab">
A = [1, 2 ; 3, 4]
B = [5, 6 ; 7, 8]
e = eig(A, B, 'nobalance')
</syntaxhighlight>}}
* OUT:
Error using eig
For generalized eigenproblem EIG(A,B), flag must be 'vector', 'matrix', 'qz', or 'chol'.
==== Computing left eigenvectors as a third output ====
* *geevx and *ggevx could also be used as these can compute not just right but left eigenvectors 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="4" | 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/d3/dfb/group__real_g_eeigen.html#gadf06d28b4793cbab21e898fcb713d5a5 sgeevx]
|-
| [http://www.netlib.org/lapack/explore-html/d4/d8a/group__complex_g_eeigen.html#ga397ffbf0007d6b72f4639379df27ae53 cgeevx]
|-
| [http://www.netlib.org/lapack/explore-html/d9/d8e/group__double_g_eeigen.html#ga58099bb0f4ebe6a1f6f6078e05a6fb78 dggevx]
| rowspan="4" | 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/d3/dfb/group__real_g_eeigen.html#ga6176eadcb5a027beb0b000fbf74f9e35 sggev]
|-
| [http://www.netlib.org/lapack/explore-html/d4/d8a/group__complex_g_eeigen.html#gad681a6edd407ef1e9ac9b6ee92ddbee3 cggevx]
|-
| [http://www.netlib.org/lapack/explore-html/d2/d8a/group__double_s_yeigen.html#ga442c43fca5493590f8f26cf42fed4044 dsyev]
| rowspan="4" | Computing all eigenvalues, optionally eigenvectors for Symmetric/Hermitan matrix
|-
| [http://www.netlib.org/lapack/explore-html/d3/d88/group__real_s_yeigen.html#ga63d8d12aef8f2711d711d9e6bd833e46 ssyev]
|-
| [http://www.netlib.org/lapack/explore-html/d6/dee/zheev_8f.html#af23fb5b3ae38072ef4890ba43d5cfea2 zheev]
|-
| [http://www.netlib.org/lapack/explore-html/df/db2/cheev_8f.html#a003ee37091d65ee62fd72da1035f06e2 cheev]
|-
| [http://www.netlib.org/lapack/explore-html/d2/d8a/group__double_s_yeigen.html#ga007d33bcdcc697e17c6d15432f159b73 dsygv]
| rowspan="4" | Generalised
|-
| [http://www.netlib.org/lapack/explore-html/d3/d88/group__real_s_yeigen.html#ga0523956327948aae43173b964188e5a2 ssygv]
|-
| [http://www.netlib.org/lapack/explore-html/dd/de2/zhegv_8f.html#af7b790b3b89de432a423c9006c1cc1ac zhegv]
|-
| [http://www.netlib.org/lapack/explore-html/d0/db9/chegv_8f.html#ab2f86fb41df5ae239798c9c3081a2d49 chegv]
|-
| [http://www.netlib.org/lapack/explore-html/d1/d7a/group__double_p_ocomputational.html#ga2f55f604a6003d03b5cd4a0adcfb74d6 dpotrf]
| rowspan="4" | 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]
|-
| [http://www.netlib.org/lapack/explore-html/d8/db2/group__real_p_ocomputational.html#gaaf31db7ab15b4f4ba527a3d31a15a58e spotrf]
|-
| [http://www.netlib.org/lapack/explore-html/d6/df6/group__complex_p_ocomputational.html#ga4e85f48dbd837ccbbf76aa077f33de19 cpotrf]
|-
|}
14

edits

Navigation menu