Mercurial > repos > public > sbplib_julia
diff test/LazyTensors/lazy_tensor_operations_test.jl @ 938:4a9a96d51940 bugfix/tensor_application_1d_cartesian_index
Fix dispatch issue when indexing a 1D TensorApplication with a CartiesianIndex
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 09 Mar 2022 11:19:17 +0100 |
parents | de2df1214394 |
children | 86889fc5b63f |
line wrap: on
line diff
--- a/test/LazyTensors/lazy_tensor_operations_test.jl Mon Feb 21 10:38:19 2022 +0100 +++ b/test/LazyTensors/lazy_tensor_operations_test.jl Wed Mar 09 11:19:17 2022 +0100 @@ -47,6 +47,9 @@ @test_broken BoundsError == (m*m*v)[7] @test_throws MethodError m*m + @test (m*v)[CartesianIndex(2)] == (:apply,v,(2,)) + @test (m*m*v)[CartesianIndex(2)] == (:apply,m*v,(2,)) + m = SizeDoublingMapping{Int, 2, 1}((3,)) @test_throws MethodError m*ones(Int,2,2) @test_throws MethodError m*m*v @@ -56,6 +59,9 @@ @test size(m*v) == 2 .*size(v) @test (m*v)[1,2] == (:apply,v,(1,2)) + @test (m*v)[CartesianIndex(2,3)] == (:apply,v,(2,3)) + @test (m*m*v)[CartesianIndex(4,3)] == (:apply,m*v,(4,3)) + struct ScalingOperator{T,D} <: TensorMapping{T,D,D} λ::T size::NTuple{D,Int}