开发者

Matrix logarithm algorithm

开发者 https://www.devze.com 2023-03-08 07:45 出处:网络
is there any way to compute the matrix logarithm in OpenCV? I understand that it\'s not available as a library function, but, pointers开发者_如何学Go to a good source (paper, textbook, etc) will be ap

is there any way to compute the matrix logarithm in OpenCV? I understand that it's not available as a library function, but, pointers开发者_如何学Go to a good source (paper, textbook, etc) will be appreciated.


As a matter of fact, I'm in the process of programming the matrix logarithm in the Eigen library which is apparently used in some Willow Garage libraries; not sure about OpenCV. Higham's book (see answer by aix) is the best reference in my opinion and I'm implementing Algorithm 11.11 in his book. That is a rather complicated algorithm though.

Diagonalization (as in Alexandre's comment) is an easy-to-program method which works very well for symmetric positive definite matrices. It also works well for many general matrices. However, it is not accurate for matrices whose eigenvalues are close together, and it fails for matrices that are not diagonalizable.

If you want something more robust than diagonalization but less complicated than Higham's Algorithm 11.11 then I'd recommend to do a Schur decomposition followed by inverse scaling and squaring. This is Algorithm 11.10 in Higham's book, and described in the paper "Approximating the Logarithm of a Matrix to Specified Accuracy" (http://dx.doi.org/10.1137/S0895479899364015, preprint at http://eprints.ma.man.ac.uk/318/).


If you use OpenCV matrices, you can easily map them to Eigen3 matrices. See this post:

OpenCV CV::Mat and Eigen::Matrix

Then, Eigen3 library has a matrix logarithm function that you can use:

http://eigen.tuxfamily.org/dox/unsupported/group__MatrixFunctions__Module.html

it is under the unsupported module, but this is not an issue, this just means:

These modules are contributions from various users. They are provided "as is", without any support.

-- http://eigen.tuxfamily.org/dox/unsupported/

Hope this is of help.

0

精彩评论

暂无评论...
验证码 换一张
取 消