help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: eigensystem


From: Patrick Alken
Subject: Re: eigensystem
Date: Tue, 19 Jan 2021 15:41:28 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

A singular matrix can still be diagonalizable. Take

[ 1 0 ]
[ 0 0 ]

for example. So it wouldn't make sense to check if a matrix is singular.
The best test is to compute the condition number of V as per my previous
email.

Patrick

On 1/19/21 3:30 PM, Patrick Dupre wrote:
> Thanks, but I think that gsl_eigen_nonsymmv must return an error or a warming
> when dealing with singular matrices.
> Of course, I just took a 3 x 3 matrix as an example, but I need to deal with
> any size of matrices, and some maybe singular.
>
> Furthermore, maxima detects the singular matrices. Why not GSL?
> Currently, we can "diagonalize" singular matrices, and deal with eigenvectors
> as they were relevant eigenvectors.
>
> Indeed, gsl_eigen_nonsymmv  could return at least an error if the matrix 
> determinant is zero
> or if eigenvalues are degenerated.
> I guess that the first thing that gsl_eigen_nonsymmv does is to calculate the 
> determinant.
>
>> Does this help?
>>
>> https://lists.gnu.org/archive/html/help-gsl/2005-02/msg00012.html
>>
>> If you get an error or a zero, the matrix cannot be inverted.
>>
>> Maybe you are asking "Isn't there a simpler way?" and I think the answer
>> is "No." I can look at your matrix and see that it does not have full
>> rank because columns 0 and 1 are perfectly correlated. But the condition
>> that must apply to have full rank is more complex: No linear combination
>> of columns can be perfectly correlated with any other linear
>> combination. That's not hard to test with a 3x3 matrix, but it becomes
>> impractical with a larger matrix.
>>
>> You could compute correlations between all pairs of columns and if any
>> correlation is 1.0 then the matrix does not have full rank (and if it's
>> very close to 1.0, then you will have stability issues). But there are
>> matricies that will pass that test that do not have full rank. So that
>> test is probably somewhat cheaper computationally, but has a known false
>> negative rate and is not a good test.
>>
>> -Alan
>>
>>
>> On 1/19/2021 4:05 PM, Patrick Dupre wrote:
>>> This is perfectly correct.
>>>
>>> My question is how do I detect singular matrix since
>>> gsl_eigen_nonsymmv
>>> does not do it?
>>>
>>>
>>>> Your matrix is singular (the first two columns are perfectly correlated,
>>>> so your matrix does not have full rank).
>>>>
>>>> The standard test of singularity is that the determinant cannot be
>>>> computed (you try to calculate it, and you get zero or a numerical
>>>> error). This post describes the problem and a shortcut:
>>>>
>>>> https://stackoverflow.com/questions/13145948/how-to-find-out-if-a-matrix-is-singular
>>>>
>>>> -Alan
>>>>
>>>>
>>>> On 1/19/2021 2:51 PM, Patrick Dupre wrote:
>>>>> gsl_eigen_nonsymmv_workspace
>>>>> has no member n_evals
>>>>>
>>>>> issue:
>>>>>
>>>>> Diagonalizing
>>>>> double data_3 [] = { 0.0, 0.0, 1.0,
>>>>>           0.0, 0.0, 0.0,
>>>>>           0.0, 0.0, 0.0 } ;
>>>>>
>>>>> I get
>>>>> eigenvalue = 0 +0i
>>>>> eigenvector = 
>>>>> 1 +0i
>>>>> 0 +0i
>>>>> 0 +0i
>>>>> eigenvalue = 0 +0i
>>>>> eigenvector = 
>>>>> 0 +0i
>>>>> 1 +0i
>>>>> 0 +0i
>>>>> eigenvalue = 0 +0i
>>>>> eigenvector = 
>>>>> -1 +0i
>>>>> 0 +0i
>>>>> 3.00625e-292 +0i
>>>>>
>>>>>
>>>>> which is wrong.
>>>>> The last eigenvector is not correct because this matrix is not 
>>>>> diagonalizable.
>>>>>
>>>>> I need to identify such matrices.
>>>>>
>>>>>
>>>>> ===========================================================================
>>>>>  Patrick DUPRÉ                                 | | email: pdupre@gmx.com
>>>>>  Laboratoire interdisciplinaire Carnot de Bourgogne
>>>>>  9 Avenue Alain Savary, BP 47870, 21078 DIJON Cedex FRANCE
>>>>>  Tel: +33 (0)380395988
>>>>> ===========================================================================
>>>>>
>>>>>
>>>>>> Sent: Tuesday, January 19, 2021 at 6:56 PM
>>>>>> From: "Patrick Alken" <patrick.alken@Colorado.EDU>
>>>>>> To: help-gsl@gnu.org
>>>>>> Subject: Re: eigensystem
>>>>>>
>>>>>> What do you mean by handle it? According to the documentation, if the
>>>>>> function cannot compute all eigenvalues, an error code is returned. In
>>>>>> the case of gsl_eigen_nonsymm, the number of converged eigenvalues is
>>>>>> stored in w->n_evals.
>>>>>>
>>>>>> Patrick
>>>>>>
>>>>>> On 1/19/21 10:33 AM, Patrick Dupre wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> Is there a way to handle the possible error of gsl_eigen_nonsymmv ?
>>>>>>>
>>>>>>> For example, when the matrix is not diagonalizable.
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> ===========================================================================
>>>>>>>  Patrick DUPRÉ                                 | | email: pdupre@gmx.com
>>>>>>>  Laboratoire interdisciplinaire Carnot de Bourgogne
>>>>>>>  9 Avenue Alain Savary, BP 47870, 21078 DIJON Cedex FRANCE
>>>>>>>  Tel: +33 (0)380395988
>>>>>>> ===========================================================================
>>>>>>>
>>>>>>>
>>>> -- 
>>>>
>>>> Alan D. Mead, Ph.D.
>>>> President, Talent Algorithms Inc.
>>>>
>>>> science + technology = better workers
>>>>
>>>> http://secure-web.cisco.com/1zrHBOw9QrpIw_ie7c5QyyUd_QUL-cVnNWKqQN9USFmbOp-vM-l5Uqsy_dFAeR6f9g1YHWdlRNeB-nq7X7q2ZdNslNHy4Cb-JvNu8PSh0Wi4S5w9pGr2E1J0JvrwmtEHCU7-KZ93v17SsUX4UliTxQ3B-2iL-nNYDy8nMHy3J9yw5mxCElCLDrFy6nYwe2a5Q6OFNISlShBpHF86jGJcpuIdwunE_c90vAl6p4qAsTCQcBgtyYdhwUANjkKDHLoqB5aI2Vhg8sdtmh4ezPeDevhBwMZpARDj54O1dsN10IN9oIweqA_gU25vfuPRB-y-FiaU4mnaLkguIbsMpe_0NfgYCSxAluQRizwiRYy59aOaxAnTsJI8dNdjksEmJXrwGgYX8FZGfxnL70A2WDL3X55BTJe7dAAexZmqZrqBU_-ZWPdPOKilv4IGBVsFrAaEsv1iX7ISkYW1ORQdJyla-5Q/http%3A%2F%2Fwww.alanmead.org
>>>>
>>>> The irony of this ... is that the Internet is
>>>> both almost-infinitely expandable, while at the
>>>> same time constrained within its own pre-defined
>>>> box. And if that makes no sense to you, just
>>>> reflect on the existence of Facebook. We have
>>>> the vastness of the internet and yet billions
>>>> of people decided to spend most of them time
>>>> within a horribly designed, fake-news emporium
>>>> of a website that sucks every possible piece of
>>>> personal information out of you so it can sell it
>>>> to others. And they see nothing wrong with that.
>>>>
>>>> -- Kieren McCarthy, commenting on why we are not 
>>>>                     all using IPv6
>>>>
>>>>
>> -- 
>>
>> Alan D. Mead, Ph.D.
>> President, Talent Algorithms Inc.
>>
>> science + technology = better workers
>>
>> http://secure-web.cisco.com/1zrHBOw9QrpIw_ie7c5QyyUd_QUL-cVnNWKqQN9USFmbOp-vM-l5Uqsy_dFAeR6f9g1YHWdlRNeB-nq7X7q2ZdNslNHy4Cb-JvNu8PSh0Wi4S5w9pGr2E1J0JvrwmtEHCU7-KZ93v17SsUX4UliTxQ3B-2iL-nNYDy8nMHy3J9yw5mxCElCLDrFy6nYwe2a5Q6OFNISlShBpHF86jGJcpuIdwunE_c90vAl6p4qAsTCQcBgtyYdhwUANjkKDHLoqB5aI2Vhg8sdtmh4ezPeDevhBwMZpARDj54O1dsN10IN9oIweqA_gU25vfuPRB-y-FiaU4mnaLkguIbsMpe_0NfgYCSxAluQRizwiRYy59aOaxAnTsJI8dNdjksEmJXrwGgYX8FZGfxnL70A2WDL3X55BTJe7dAAexZmqZrqBU_-ZWPdPOKilv4IGBVsFrAaEsv1iX7ISkYW1ORQdJyla-5Q/http%3A%2F%2Fwww.alanmead.org
>>
>> The irony of this ... is that the Internet is
>> both almost-infinitely expandable, while at the
>> same time constrained within its own pre-defined
>> box. And if that makes no sense to you, just
>> reflect on the existence of Facebook. We have
>> the vastness of the internet and yet billions
>> of people decided to spend most of them time
>> within a horribly designed, fake-news emporium
>> of a website that sucks every possible piece of
>> personal information out of you so it can sell it
>> to others. And they see nothing wrong with that.
>>
>> -- Kieren McCarthy, commenting on why we are not 
>>                     all using IPv6
>>
>>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]