@@ -56,6 +56,8 @@ using Test, LinearMaps, LinearAlgebra
5656 @test @inferred mul! (similar (v), CS!, v) == cv
5757 @test_throws ErrorException CS!' v
5858 @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)
5961 CS! = LinearMap {ComplexF64} (cumsum!, (y, x) -> (copyto! (y, x); reverse! (y); cumsum! (y, y)), 10 ; ismutating= true )
6062 @inferred adjoint (CS!)
6163 @test @inferred LinearMaps. ismutating (CS!)
@@ -73,15 +75,37 @@ using Test, LinearMaps, LinearAlgebra
7375 @test @inferred transpose (2 * L) * v ≈ 2 * v
7476 L = @inferred LinearMap {ComplexF64} (x -> x, x -> x, 10 )
7577 v = rand (ComplexF64, 10 )
78+ w = similar (v)
7679 @test @inferred (2 * L)' * v ≈ 2 * v
7780 @test @inferred transpose (2 * L) * v ≈ 2 * v
7881
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)
87111end
0 commit comments