Mercurial > repos > public > sbplib_julia
comparison test/testLazyTensors.jl @ 485:4b49f03bdb98 feature/compose_identity_mappings
Switch from DimensionMismatch to SizeMismatch for boundschecks on compositions
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 05 Nov 2020 10:49:27 +0100 |
parents | 95f3b9036801 |
children | 8082d43103c1 |
comparison
equal
deleted
inserted
replaced
484:b995f056ad1f | 485:4b49f03bdb98 |
---|---|
224 B̃ = LazyLinearMap(B, (1,), (2,)) | 224 B̃ = LazyLinearMap(B, (1,), (2,)) |
225 | 225 |
226 @test Ã∘B̃ isa TensorMappingComposition | 226 @test Ã∘B̃ isa TensorMappingComposition |
227 @test range_size(Ã∘B̃) == (2,) | 227 @test range_size(Ã∘B̃) == (2,) |
228 @test domain_size(Ã∘B̃) == (4,) | 228 @test domain_size(Ã∘B̃) == (4,) |
229 @test_throws DimensionMismatch B̃∘Ã | 229 @test_throws SizeMismatch B̃∘Ã |
230 | 230 |
231 # @test @inbounds B̃∘Ã # Should not error even though dimensions don't match. (Since ]test runs with forced boundschecking this is currently not testable 2020-10-16) | 231 # @test @inbounds B̃∘Ã # Should not error even though dimensions don't match. (Since ]test runs with forced boundschecking this is currently not testable 2020-10-16) |
232 | 232 |
233 v = rand(4) | 233 v = rand(4) |
234 @test Ã∘B̃*v ≈ A*B*v rtol=1e-14 | 234 @test Ã∘B̃*v ≈ A*B*v rtol=1e-14 |
318 I1 = IdentityMapping{Float64}(2) | 318 I1 = IdentityMapping{Float64}(2) |
319 I2 = IdentityMapping{Float64}(4) | 319 I2 = IdentityMapping{Float64}(4) |
320 @test A∘I1 == A | 320 @test A∘I1 == A |
321 @test I2∘A == A | 321 @test I2∘A == A |
322 @test I1∘I1 == I1 | 322 @test I1∘I1 == I1 |
323 @test_throws DimensionMismatch I1∘A | 323 @test_throws SizeMismatch I1∘A |
324 @test_throws DimensionMismatch A∘I2 | 324 @test_throws SizeMismatch A∘I2 |
325 @test_throws DimensionMismatch I1∘I2 | 325 @test_throws SizeMismatch I1∘I2 |
326 end | 326 end |
327 | 327 |
328 @testset "InflatedTensorMapping" begin | 328 @testset "InflatedTensorMapping" begin |
329 I(sz...) = IdentityMapping(sz...) | 329 I(sz...) = IdentityMapping(sz...) |
330 | 330 |