@@ -559,14 +559,13 @@ function schurpow(A::AbstractMatrix, p)
559
559
end
560
560
end
561
561
function (^ )(A:: AbstractMatrix{T} , p:: Real ) where T
562
- n = checksquare (A)
563
-
562
+ checksquare (A)
564
563
# Quicker return if A is diagonal
565
564
if isdiag (A)
566
565
TT = promote_op (^ , T, typeof (p))
567
566
retmat = copymutable_oftype (A, TT)
568
- for i in axes (retmat,1 )
569
- retmat[i, i ] = retmat[i, i] ^ p
567
+ for i in diagind (retmat, IndexStyle (retmat) )
568
+ retmat[i] = retmat[i] ^ p
570
569
end
571
570
return retmat
572
571
end
@@ -1080,7 +1079,7 @@ function sin(A::AbstractMatrix{<:Complex})
1080
1079
T = complex (float (eltype (A)))
1081
1080
X = exp! (T .(im .* A))
1082
1081
Y = exp! (T .(.- im .* A))
1083
- @inbounds for i in eachindex (X)
1082
+ @inbounds for i in eachindex (X, Y )
1084
1083
x, y = X[i]/ 2 , Y[i]/ 2
1085
1084
X[i] = Complex (imag (x)- imag (y), real (y)- real (x))
1086
1085
end
@@ -1128,7 +1127,7 @@ function sincos(A::AbstractMatrix{<:Complex})
1128
1127
T = complex (float (eltype (A)))
1129
1128
X = exp! (T .(im .* A))
1130
1129
Y = exp! (T .(.- im .* A))
1131
- @inbounds for i in eachindex (X)
1130
+ @inbounds for i in eachindex (X, Y )
1132
1131
x, y = X[i]/ 2 , Y[i]/ 2
1133
1132
X[i] = Complex (imag (x)- imag (y), real (y)- real (x))
1134
1133
Y[i] = x+ y
@@ -1200,7 +1199,7 @@ function tanh(A::AbstractMatrix)
1200
1199
end
1201
1200
X = exp (A)
1202
1201
Y = exp! (float .(.- A))
1203
- @inbounds for i in eachindex (X)
1202
+ @inbounds for i in eachindex (X, Y )
1204
1203
x, y = X[i], Y[i]
1205
1204
X[i] = x - y
1206
1205
Y[i] = x + y
0 commit comments