Re: [eigen] unpleasant surprise mit math functions

[ Thread Index | Date Index | More Archives ]

On 26 Sep 2012, at 20:13, Helmut Jarausch wrote:

> On 09/26/2012 06:43:10 PM, rupp@xxxxxxxxxxxxxxxx wrote:
>> Hi Helmut,
>> just out of curiosity:
>> which unified behavior do you expect for exp(A), sin(A) and cos(A),  
>> with A being a dense matrix? If you want it to act on each entry  
>> separately, then the result of exp(A) is probably not what a  
>> significant number of people may expect. However, using a power  
>> series expansion for exp, sin and cos is clearly not equivalent to  
>> sin(t.array())...
> There are 2 papers title "19 )(new) dubious ways to compute the matrix  
> exponential".
> Therefore, a general package like Eigen shouldn't even try to compute  
> the "matrix versions".
I'm not totally sure what you mean by this statement, but just to point out that Eigen does provide a matrix exponential function in unsupported/Eigen/MatrixFunctions. Although there are (at least) 19 ways to compute the matrix exponential, Eigen uses the algorithm from N Higham's 2005 paper, which is good enough to be the default in Matlab.

However, this seems a good time to mention this article:
which does highlight some situations where the algorithm can fail (if you have to have matrix elements that differ by 18 orders of magnitude!). There is a link at the bottom of the article to an improved algorithm developed by Higham's PhD student. I wanted to implement and contribute this to Eigen, but frankly the new algorithm makes my head spin, so I feel under-qualified for such work.


Mail converted by MHonArc 2.6.19+