Matrix square root
X = sqrtm(
returns the principal square root of the matrixA
)A
, that is,X*X = A
.
X
is the unique square root for which every eigenvalue has nonnegative real part. IfA
has any eigenvalues with negative real parts, then a complex result is produced. IfA
is singular, thenA
可能没有a square root. If exact singularity is detected, a warning is printed.
[X,residual] = sqrtm(
also returns the residual,A
)residual = norm(A-X^2,1)/norm(A,1)
. This syntax does not print warnings if exact singularity is detected.
[X,alpha,condx] = sqrtm(
returns stability factorA
)alpha
and an estimate of the matrix square root condition number ofX
in 1-norm,condx
. The residualnorm(A-X^2,1)/norm(A,1)
is bounded approximately byn*alpha*eps
and the 1-norm relative error inX
is bounded approximately byn*alpha*condx*eps
, wheren = max(size(A))
.
Some matrices, likeA = [0 1; 0 0]
, do not have any square roots, real or complex, andsqrtm
cannot be expected to produce one.
The algorithmsqrtm
uses is described in[3].
[1] N.J. Higham, “Computing real square roots of a real matrix,”Linear Algebra and Appl., 88/89, pp. 405–430, 1987
[2] Bjorck, A. and S. Hammerling, “A Schur method for the square root of a matrix,”Linear Algebra and Appl., 52/53, pp. 127–140, 1983
[3] Deadman, E., Higham, N. J. and R. Ralha, “Blocked Schur algorithms for computing the matrix square root,”Lecture Notes in Comput. Sci., 7782,气象出版社,页171–182, 2013