Skip to content

Commit f5fcff4

Browse files
committed
add test
1 parent 058bce4 commit f5fcff4

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎test/exponential.jl‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,24 @@ end
5757
@test_throws DomainError exponential((τ, A); alg = MatrixFunctionViaEigh(LAPACK_QRIteration()))
5858
end
5959

60+
@testset "exponential! for non-Matrix input $T" for T in BLASFloats
61+
rng = StableRNG(123)
62+
m = 12
63+
A = LinearAlgebra.normalize!(randn(rng, T, m, m))
64+
expA = LinearAlgebra.exp(A)
65+
66+
wrappers = (
67+
("view", B -> view(B, :, :)),
68+
("PermutedDimsArray", B -> PermutedDimsArray(permutedims(B), (2, 1))),
69+
("ReshapedArray", B -> reshape(view(vec(B), 1:(m * m)), m, m)),
70+
)
71+
@testset "$name" for (name, wrap) in wrappers
72+
W = wrap(copy(A))
73+
@test !(W isa Matrix)
74+
@test exponential!(W) ≈ expA
75+
end
76+
end
77+
6078
@testset "exponential! for Diagonal{$T}" for T in (BLASFloats..., GenericFloats...)
6179
rng = StableRNG(123)
6280
m = 54

0 commit comments

Comments
 (0)