Mercurial > repos > public > sbplib_julia
comparison 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 |
comparison
equal
deleted
inserted
replaced
988:83046af6143a | 992:bc384aaade30 |
---|---|
261 @test_throws SizeMismatch I1∘A | 261 @test_throws SizeMismatch I1∘A |
262 @test_throws SizeMismatch A∘I2 | 262 @test_throws SizeMismatch A∘I2 |
263 @test_throws SizeMismatch I1∘I2 | 263 @test_throws SizeMismatch I1∘I2 |
264 end | 264 end |
265 | 265 |
266 @testset "ScalingTensor" begin | |
267 st = ScalingTensor(2.,(3,4)) | |
268 @test st isa TensorMapping{Float64, 2, 2} | |
269 @test range_size(st) == (3,4) | |
270 @test domain_size(st) == (3,4) | |
271 | |
272 v = rand(3,4) | |
273 @test st*v == 2.0 .* v | |
274 @test st'*v == 2.0 .* v | |
275 | |
276 @inferred (st*v)[2,2] | |
277 @inferred (st'*v)[2,2] | |
278 end | |
279 | |
266 @testset "InflatedTensorMapping" begin | 280 @testset "InflatedTensorMapping" begin |
267 I(sz...) = IdentityMapping(sz...) | 281 I(sz...) = IdentityMapping(sz...) |
268 | 282 |
269 Ã = rand(4,2) | 283 Ã = rand(4,2) |
270 B̃ = rand(4,2,3) | 284 B̃ = rand(4,2,3) |