Mercurial > repos > public > sbplib_julia
diff test/LazyTensors/lazy_tensor_operations_test.jl @ 992:bc384aaade30 refactor/lazy_tensors
Add a bunch of todos and add a ScalingTensor
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 18 Mar 2022 17:28:07 +0100 |
parents | 043d13ef8898 |
children | 2f9beee56a4c |
line wrap: on
line diff
--- a/test/LazyTensors/lazy_tensor_operations_test.jl Wed Mar 16 18:39:00 2022 +0100 +++ b/test/LazyTensors/lazy_tensor_operations_test.jl Fri Mar 18 17:28:07 2022 +0100 @@ -263,6 +263,20 @@ @test_throws SizeMismatch I1∘I2 end +@testset "ScalingTensor" begin + st = ScalingTensor(2.,(3,4)) + @test st isa TensorMapping{Float64, 2, 2} + @test range_size(st) == (3,4) + @test domain_size(st) == (3,4) + + v = rand(3,4) + @test st*v == 2.0 .* v + @test st'*v == 2.0 .* v + + @inferred (st*v)[2,2] + @inferred (st'*v)[2,2] +end + @testset "InflatedTensorMapping" begin I(sz...) = IdentityMapping(sz...)