Qu

sqrtm

Builtin index · Core maths

sqrtm(A)

Input: A · Output: no output

What it is

Principal square root of a dense real square matrix (the root whose eigenvalues have non-negative real part), by the Bjorck-Hammarling recurrence on the complex Schur form: sqrtm(A)*sqrtm(A) = A to rounding. The result is a real Mat whenever A has no eigenvalue on the negative real axis, which includes complex-conjugate pairs and singular matrices with a semisimple zero eigenvalue (sqrtm([1 1; 1 1])). If A has a negative real eigenvalue the principal root exists only as a complex matrix, and that complex matrix is returned (sqrtm([-4 0; 0 1]) has 2j and 1 on the diagonal). Cost O(n³); accuracy degrades with the condition of the eigenvector basis, as for any Schur method. Errors: a non-square, empty or non-finite matrix, a complex matrix, and a matrix with no square root at all (a zero eigenvalue with a nontrivial Jordan block, such as [0 1; 0 0]).

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
sqrtm(A)
A matrix or Matnot documented yet
not documented yetCost O(n³); accuracy degrades with the condition of the eigenvector basis, as for any Schur method. Errors: a non-square, empty or non-finite matrix, a complex matrix, and a matrix with no square root at all (a zero eigenvalue with a nontrivial Jordan block, such as [0 1; 0 0]).

Examples

No documentation example calls this form yet. The Core maths chapter is where one belongs.