comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: MATRIX LOGARITHM (and EXPONENTIAL)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: MATRIX LOGARITHM (and EXPONENTIAL) [message #74693] Thu, 27 January 2011 16:11 Go to next message
James[2] is currently offline  James[2]
Messages: 44
Registered: November 2009
Member
On Jan 27, 4:10 pm, James <donje...@gmail.com> wrote:
>
> If the matrix A is diagonalizable, then:
>
> eigenvals = LA_EIGENPROBLEM(A, EIGENVECTORS=evecs)
> expA = evecs # diag_matrix(exp(eigenvals)) # invert(evecs)
> logA = evecs # diag_matrix(alog(eigenvals)) # invert(evecs)

sorry, replace INVERT with LA_INVERT to account for complex
eigenvectors.
Re: MATRIX LOGARITHM (and EXPONENTIAL) [message #74694 is a reply to message #74693] Thu, 27 January 2011 16:10 Go to previous messageGo to next message
James[2] is currently offline  James[2]
Messages: 44
Registered: November 2009
Member
On Jan 27, 1:41 pm, teddyallen <teddyal...@yahoo.com> wrote:
> Just a quick question. Does IDL have a similar command to the popular
> MATLAB logm and expm so that I can take the matrix logarithm (and
> exponential)? I understand that ALOG and EXP will not function in this
> sense.
> Thank you,
> teddy

If the matrix A is diagonalizable, then:

eigenvals = LA_EIGENPROBLEM(A, EIGENVECTORS=evecs)
expA = evecs # diag_matrix(exp(eigenvals)) # invert(evecs)
logA = evecs # diag_matrix(alog(eigenvals)) # invert(evecs)
Re: MATRIX LOGARITHM (and EXPONENTIAL) [message #74696 is a reply to message #74694] Thu, 27 January 2011 14:40 Go to previous messageGo to next message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
On Jan 27, 5:37 pm, Paulo Penteado <pp.pente...@gmail.com> wrote:
> On Jan 27, 7:41 pm, teddyallen <teddyal...@yahoo.com> wrote:
>
>> Just a quick question. Does IDL have a similar command to the popular
>> MATLAB logm and expm so that I can take the matrix logarithm (and
>> exponential)? I understand that ALOG and EXP will not function in this
>> sense.
>
> Can you explain what matrix log and exp are?

If A is a matrix, and # matrix multiplication

exp(A) = sum over k of A^k/k!

where A^2= A#A, A^3=A#A#A etc.

Ciao,
Paolo
Re: MATRIX LOGARITHM (and EXPONENTIAL) [message #74697 is a reply to message #74696] Thu, 27 January 2011 14:39 Go to previous messageGo to next message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
On Jan 27, 4:41 pm, teddyallen <teddyal...@yahoo.com> wrote:
> Just a quick question. Does IDL have a similar command to the popular
> MATLAB logm and expm so that I can take the matrix logarithm (and
> exponential)? I understand that ALOG and EXP will not function in this
> sense.
> Thank you,
> teddy

No, IDL doesn't have those functions built in.

I don't know if anyone has written routines to compute
either of those.

Do you need a solution for general arrays? In special cases
(say, if the determinant is small or the matrix can be
diagonalized) it may not be too hard to write a routine
for it. For more general cases it may be a bit more challenging.

Ciao,
Paolo
Re: MATRIX LOGARITHM (and EXPONENTIAL) [message #74698 is a reply to message #74697] Thu, 27 January 2011 14:37 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jan 27, 7:41 pm, teddyallen <teddyal...@yahoo.com> wrote:
> Just a quick question. Does IDL have a similar command to the popular
> MATLAB logm and expm so that I can take the matrix logarithm (and
> exponential)? I understand that ALOG and EXP will not function in this
> sense.

Can you explain what matrix log and exp are?
Re: MATRIX LOGARITHM (and EXPONENTIAL) [message #92161 is a reply to message #74693] Wed, 21 October 2015 16:04 Go to previous messageGo to next message
zhaobw1993 is currently offline  zhaobw1993
Messages: 1
Registered: October 2015
Junior Member
On Thursday, January 27, 2011 at 5:11:53 PM UTC-7, James wrote:
> On Jan 27, 4:10 pm, James <donje...@gmail.com> wrote:
>>
>> If the matrix A is diagonalizable, then:
>>
>> eigenvals = LA_EIGENPROBLEM(A, EIGENVECTORS=evecs)
>> expA = evecs # diag_matrix(exp(eigenvals)) # invert(evecs)
>> logA = evecs # diag_matrix(alog(eigenvals)) # invert(evecs)
>
> sorry, replace INVERT with LA_INVERT to account for complex
> eigenvectors.

Does logA need to be transposed?
My way was,
evens = transpose(evens)
logA = evecs ## diag_matrix(eigenvalues) ## invert(evecs)
result of this way seems to be transpose of result of your way.

Thanks
Re: MATRIX LOGARITHM (and EXPONENTIAL) [message #92178 is a reply to message #92161] Fri, 23 October 2015 10:52 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Wednesday, October 21, 2015 at 5:04:18 PM UTC-6, zhaob...@gmail.com wrote:
> On Thursday, January 27, 2011 at 5:11:53 PM UTC-7, James wrote:
>> On Jan 27, 4:10 pm, James <donje...@gmail.com> wrote:
>>>
>>> If the matrix A is diagonalizable, then:
>>>
>>> eigenvals = LA_EIGENPROBLEM(A, EIGENVECTORS=evecs)
>>> expA = evecs # diag_matrix(exp(eigenvals)) # invert(evecs)
>>> logA = evecs # diag_matrix(alog(eigenvals)) # invert(evecs)
>>
>> sorry, replace INVERT with LA_INVERT to account for complex
>> eigenvectors.
>
> Does logA need to be transposed?
> My way was,
> evens = transpose(evens)
> logA = evecs ## diag_matrix(eigenvalues) ## invert(evecs)
> result of this way seems to be transpose of result of your way.
>
> Thanks

Or, you could use the Python bridge:

la = Python.Import('scipy.linalg')
expm = la.expm(A)
logm = la.logm(A)

-Chris
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Read irregular data problem
Next Topic: Display of hyperspectral image in the window of a specified size

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 09:22:27 PDT 2025

Total time taken to generate the page: 0.00905 seconds