Skip to content
Snippets Groups Projects
Commit 2a3e8d60 authored by Christian Beckmann's avatar Christian Beckmann
Browse files

added sqrtm

parent 72f5364e
No related branches found
No related tags found
No related merge requests found
...@@ -1368,6 +1368,16 @@ ReturnMatrix sqrt(const Matrix& mat) ...@@ -1368,6 +1368,16 @@ ReturnMatrix sqrt(const Matrix& mat)
return res; return res;
} }
ReturnMatrix sqrtm(const Matrix& mat)
{
Matrix res, tmpU, tmpV;
DiagonalMatrix tmpD;
SVD(mat, tmpD, tmpU, tmpV);
res = tmpU*sqrt(tmpD)*tmpV.t();
res.Release();
return res;
}
ReturnMatrix log(const Matrix& mat) ReturnMatrix log(const Matrix& mat)
{ {
Matrix res = mat; Matrix res = mat;
......
...@@ -214,6 +214,7 @@ namespace MISCMATHS { ...@@ -214,6 +214,7 @@ namespace MISCMATHS {
ReturnMatrix dist2(const Matrix& mat1, const Matrix& mat2); ReturnMatrix dist2(const Matrix& mat1, const Matrix& mat2);
ReturnMatrix abs(const Matrix& mat); ReturnMatrix abs(const Matrix& mat);
ReturnMatrix sqrt(const Matrix& mat); ReturnMatrix sqrt(const Matrix& mat);
ReturnMatrix sqrtm(const Matrix& mat);
ReturnMatrix log(const Matrix& mat); ReturnMatrix log(const Matrix& mat);
ReturnMatrix exp(const Matrix& mat); ReturnMatrix exp(const Matrix& mat);
ReturnMatrix tanh(const Matrix& mat); ReturnMatrix tanh(const Matrix& mat);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment