[Rd] eigen(symmetric=TRUE) for complex matrices
Berend Hasselman
bhh at xs4all.nl
Tue Jun 18 17:20:44 CEST 2013
On 18-06-2013, at 09:57, peter dalgaard <pdalgd at gmail.com> wrote:
>
> On Jun 18, 2013, at 03:30 , robin hankin wrote:
>
>> R-3.0.1 rev 62743, binary downloaded from CRAN just now; macosx 10.8.3
>>
>> Hello,
>>
>> eigen(symmetric=TRUE) behaves strangely when given complex matrices.
>>
>>
>> The following two lines define 'A', a 100x100 (real) symmetric matrix
>> which theoretical considerations [Bochner's theorem] show to be positive
>> definite:
>>
>> jj <- matrix(0,100,100)
>> A <- exp(-0.1*(row(jj)-col(jj))^2)
>>
>>
>> A's being positive-definite is important to me:
>>
>>
>>> min(eigen(A,T,T)$values)
>> [1] 2.521153e-10
>>>
>>
>> Coercing A to a complex matrix should make no difference, but makes
>> eigen() return the wrong answer:
>>
>>> min(eigen(A+0i,T,T)$values)
>> [1] -0.359347
>>>
>>
>> This is very, very wrong.
>
> Yep. I see this also on 10.6/7 (Snow Leopard, Lion) and 3.0.x, but NOT with a MacPorts build of 2.15.3 that I had lying around.
>
> So this sits somewhere between Mac builds, R versions, and possibly LAPACK issues. Can anyone reproduce on non-Mac?
>
The problem does not occur with the Cran binary of R-3.0.1 Kubuntu 12.04 64-bit.
That R uses the system provided Blas (libblas 1.2.30110419) and Lapack 3.3.1; I don't know if these have been patched.
I have been able to reproduce the problem on a self compiled version of R-3.0.1 using Rlapack and Rblas on Ubuntu 10.04 64-bit.
Berend
More information about the R-devel
mailing list