3

How can I compute the logarithm of a matrix using SAS IML?

I am trying to get something similar to the functionality of the Matlab logm() function.

jaamor
  • 317
  • 3
  • 15
  • I don't know if there's a built in way to do that. There is an implementation of the inverse in the IMLMLIB library ( [EXPMATRIX](https://support.sas.com/documentation/cdl/en/imlug/68150/HTML/default/viewer.htm#imlug_langref_sect127.htm) ) but I don't see a LOGMATRIX equivalent. Hopefully Rick will see this and be able to give you better direction - either to how to do it natively or a paper or something of someone else having implemented an algorithm. – Joe May 05 '16 at 14:19
  • I assume that you have a real matrix? Is it symmetric? – Rick May 06 '16 at 14:12
  • Hello Rick, it is real and not symmetric. – jaamor May 11 '16 at 15:13

1 Answers1

1

I am not aware of a pre-written function that will do this, so you will need to write it yourself. However, Nick Higham has supplied this functions in his 'mftoolbox' set of functions. MATLAB and SAS/IML are very similar, so it is not too difficult to convert Higham's code from MATLAB to IML.

There are several logm() algorithms. I'd recommend the inverse scaling and squaring method, which is implemented in Higham's logm_iss.m file. That function calls several other functions that you also need to implement: sqrtm_dbp(), logm_pade_pf()

The background information and examples are provided in several of Higham's papers, most of which are available from his home page or from Google Scholar. You can also read Higham (2008) Functions of Matrices: Theory and Computation.

Rick
  • 1,210
  • 6
  • 11