comparison test/testLazyTensors.jl @ 411:4aa59af074ef feature/LazyLinearMap/transpose

Add implementation of apply_transpose for LazyLinearMap
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 15 Oct 2020 22:06:54 +0200
parents 3b4b1758a8ad
children 814865d40f48 3796e296fe64 46acb2560451
comparison
equal deleted inserted replaced
410:26e186b565b3 411:4aa59af074ef
217 # Test a standard matrix-vector product 217 # Test a standard matrix-vector product
218 # mapping vectors of size 4 to vectors of size 3. 218 # mapping vectors of size 4 to vectors of size 3.
219 A = rand(3,4) 219 A = rand(3,4)
220 Ã = LazyLinearMap(A, (1,), (2,)) 220 Ã = LazyLinearMap(A, (1,), (2,))
221 v = rand(4) 221 v = rand(4)
222 w = rand(3)
222 223
223 @test à isa LazyLinearMap{T,1,1} where T 224 @test à isa LazyLinearMap{T,1,1} where T
224 @test à isa TensorMapping{T,1,1} where T 225 @test à isa TensorMapping{T,1,1} where T
225 @test range_size(Ã) == (3,) 226 @test range_size(Ã) == (3,)
226 @test domain_size(Ã) == (4,) 227 @test domain_size(Ã) == (4,)
227 228
228 @test Ã*ones(4) ≈ A*ones(4) atol=5e-13 229 @test Ã*ones(4) ≈ A*ones(4) atol=5e-13
229 @test Ã*v ≈ A*v atol=5e-13 230 @test Ã*v ≈ A*v atol=5e-13
231 @test Ã'*w ≈ A'*w
230 232
231 A = rand(2,3,4) 233 A = rand(2,3,4)
232 @test_throws DomainError LazyLinearMap(A, (3,1), (2,)) 234 @test_throws DomainError LazyLinearMap(A, (3,1), (2,))
233 235
234 # Test more exotic mappings 236 # Test more exotic mappings