Skip to content

Commit

Permalink
Extend sqrtm to StridedMatrix and complex integer matrices.
Browse files Browse the repository at this point in the history
  • Loading branch information
GunnarFarneback committed Feb 9, 2013
1 parent 440bbc5 commit df9b1db
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions base/linalg_dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ svdvals(A::StridedMatrix, B::StridedMatrix) = LAPACK.ggsvd!('N', 'N', 'N', copy(

schur{T<:BlasFloat}(A::StridedMatrix{T}) = LAPACK.gees!('V', copy(A))

function sqrtm(A::Matrix, cond::Bool)
function sqrtm(A::StridedMatrix, cond::Bool)
m, n = size(A)
if m != n error("DimentionMismatch") end
if ishermitian(A)
Expand Down Expand Up @@ -848,7 +848,9 @@ function sqrtm(A::Matrix, cond::Bool)
end
end
end
sqrtm(A::Matrix) = sqrtm(A, false)
sqrtm{T<:Integer}(A::StridedMatrix{T}, cond::Bool) = sqrtm(float(A), cond)
sqrtm{T<:Integer}(A::StridedMatrix{ComplexPair{T}}, cond::Bool) = sqrtm(complex128(A), cond)
sqrtm(A::StridedMatrix) = sqrtm(A, false)
sqrtm(a::Number) = isreal(a) ? (b = sqrt(complex(a)); imag(b) == 0 ? real(b) : b) : sqrt(a)

function (\){T<:BlasFloat}(A::StridedMatrix{T}, B::StridedVecOrMat{T})
Expand Down

0 comments on commit df9b1db

Please sign in to comment.