The main problem is that it cannot really be determined before whether the
eigen solution is real or complex before the calculation is over in
contrast to the `sqrt` case. I think it would be a little annoying to get a
complex result from a symmetric matrix. Like if

julia> sqrt(4.0)
2.0 + 0.0im


2014-01-29 Jason Merrill <[email protected]>

> The return type seems somewhat orthogonal to the polyalgorithm point that
> you bring up. eig could still dispatch to special symmetric matrix methods
> internally, but always return Complex results.
>
>
> On Tuesday, January 28, 2014 8:38:18 PM UTC-8, Jiahao Chen wrote:
>>
>> The reason is primarily for performance and secondarily for numerical
>> stability. eig() on a Matrix implements a polyalgorithm depending on
>> the symmetries of the input matrix. Certain symmetries, e.g. real
>> symmetric or Hermitian, can be solve significantly more efficiently
>> than the general case, and so eig() attempts to detect these
>> symmetries at runtime and if found, dispatch to different LAPACK
>> routines that are able to take advantage of faster and more stable
>> algorithms. Several other generic linear algebraic functions are
>> written in this fashion, notably \.
>>
>> (This was recently discussed in the context of issue #4006 with
>> particular focus on sqrtm, whose code is somewhat easier to read than
>> eigfact!. https://github.com/JuliaLang/julia/issues/4006)
>>
>> Thanks,
>>
>> Jiahao Chen, PhD
>> Staff Research Scientist
>> MIT Computer Science and Artificial Intelligence Laboratory
>>
>


-- 
Med venlig hilsen

Andreas Noack Jensen

Reply via email to