Search code examples
saslinear-algebrasas-iml

compute the logarithm of a matrix using SAS IML


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.


Solution

  • 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.