Mercurial > repos > public > sbplib_julia
comparison test/LazyTensors/lazy_tensor_operations_test.jl @ 1084:2e606d4c0ab1 feature/scalar_times_tensor
Add support for multiplying a LazyTensor with a scalar
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 14 Apr 2022 18:12:59 +0200 |
parents | 6abbb2c6c3e4 |
children | 2278730f9cee 1e8270c18edb 97dfca9ec054 |
comparison
equal
deleted
inserted
replaced
1082:9abb140a4636 | 1084:2e606d4c0ab1 |
---|---|
179 v = rand(2) | 179 v = rand(2) |
180 @test (Ã∘B̃)'*v ≈ B'*A'*v rtol=1e-14 | 180 @test (Ã∘B̃)'*v ≈ B'*A'*v rtol=1e-14 |
181 | 181 |
182 @test (Ã∘B̃*ComplexF64[1.,2.,3.,4.])[1] isa ComplexF64 | 182 @test (Ã∘B̃*ComplexF64[1.,2.,3.,4.])[1] isa ComplexF64 |
183 @test ((Ã∘B̃)'*ComplexF64[1.,2.])[1] isa ComplexF64 | 183 @test ((Ã∘B̃)'*ComplexF64[1.,2.])[1] isa ComplexF64 |
184 | |
185 a = 2. | |
186 v = rand(3) | |
187 @test a*Ã isa TensorComposition | |
188 @test a*Ã == Ã*a | |
189 @test range_size(a*Ã) == range_size(Ã) | |
190 @test domain_size(a*Ã) == domain_size(Ã) | |
191 @test a*Ã*v == a.*A*v | |
184 end | 192 end |
185 | 193 |
186 | 194 |
187 @testset "InflatedTensor" begin | 195 @testset "InflatedTensor" begin |
188 I(sz...) = IdentityTensor(sz...) | 196 I(sz...) = IdentityTensor(sz...) |