@@ -56,6 +56,8 @@ using Test, LinearMaps, LinearAlgebra
56
56
@test @inferred mul! (similar (v), CS!, v) == cv
57
57
@test_throws ErrorException CS!' v
58
58
@test_throws ErrorException adjoint (CS!) * v
59
+ @test_throws ErrorException mul! (similar (v), CS!' , v)
60
+ @test_throws ErrorException mul! (similar (v), transpose (CS!), v)
59
61
CS! = LinearMap {ComplexF64} (cumsum!, (y, x) -> (copyto! (y, x); reverse! (y); cumsum! (y, y)), 10 ; ismutating= true )
60
62
@inferred adjoint (CS!)
61
63
@test @inferred LinearMaps. ismutating (CS!)
@@ -73,15 +75,37 @@ using Test, LinearMaps, LinearAlgebra
73
75
@test @inferred transpose (2 * L) * v ≈ 2 * v
74
76
L = @inferred LinearMap {ComplexF64} (x -> x, x -> x, 10 )
75
77
v = rand (ComplexF64, 10 )
78
+ w = similar (v)
76
79
@test @inferred (2 * L)' * v ≈ 2 * v
77
80
@test @inferred transpose (2 * L) * v ≈ 2 * v
78
81
79
- L = LinearMap {ComplexF64} (identity, 10 ; issymmetric= true )
80
- @test L * v == v
81
- @test adjoint (L) * v == v
82
- @test transpose (L) * v == v
83
- L = LinearMap {ComplexF64} (identity, 10 ; ishermitian= true )
84
- @test L * v == v
85
- @test adjoint (L) * v == v
86
- @test transpose (L) * v == v
82
+ A = rand (ComplexF64, 10 , 10 )
83
+ L = LinearMap {ComplexF64} (x -> A* x, 10 )
84
+ @test L * v == A * v == mul! (w, L, v)
85
+ L = LinearMap {ComplexF64} ((y, x) -> mul! (y, A, x), 10 )
86
+ @test L * v == A * v == mul! (w, L, v)
87
+ L = LinearMap {ComplexF64} ((y, x) -> mul! (y, A, x), (y, x) -> mul! (y, A' , x), 10 )
88
+ @test L * v == A * v == mul! (w, L, v)
89
+ @test adjoint (L) * v ≈ A' v ≈ mul! (w, L' , v)
90
+ @test transpose (L) * v ≈ transpose (A)* v ≈ mul! (w, transpose (L), v)
91
+
92
+ A = Symmetric (rand (ComplexF64, 10 , 10 ))
93
+ L = LinearMap {ComplexF64} (x -> A* x, 10 ; issymmetric= true )
94
+ @test L * v == A * v == mul! (w, L, v)
95
+ @test adjoint (L) * v ≈ A' v ≈ mul! (w, L' , v)
96
+ @test transpose (L) * v ≈ transpose (A)* v ≈ mul! (w, transpose (L), v)
97
+ L = LinearMap {ComplexF64} ((y, x) -> mul! (y, A, x), 10 ; issymmetric= true )
98
+ @test L * v == A * v == mul! (w, L, v)
99
+ @test adjoint (L) * v ≈ A' v ≈ mul! (w, L' , v)
100
+ @test transpose (L) * v ≈ transpose (A)* v ≈ mul! (w, transpose (L), v)
101
+
102
+ A = Hermitian (rand (ComplexF64, 10 , 10 ))
103
+ L = LinearMap {ComplexF64} (x -> A* x, 10 ; ishermitian= true )
104
+ @test L * v == A * v == mul! (w, L, v)
105
+ @test adjoint (L) * v ≈ A' v ≈ mul! (w, L' , v)
106
+ @test transpose (L) * v ≈ transpose (A)* v ≈ mul! (w, transpose (L), v)
107
+ L = LinearMap {ComplexF64} ((y, x) -> mul! (y, A, x), 10 ; ishermitian= true )
108
+ @test L * v == A * v == mul! (w, L, v)
109
+ @test adjoint (L) * v ≈ A' v ≈ mul! (w, L' , v)
110
+ @test transpose (L) * v ≈ transpose (A)* v ≈ mul! (w, transpose (L), v)
87
111
end
0 commit comments