Mercurial > repos > public > sbplib_julia
comparison test/LazyTensors/lazy_tensor_operations_test.jl @ 1012:2c1a0722ddb9 feature/lazy_tensors/pretty_printing
Add pretty printing for inflated tensor
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 21 Mar 2022 09:07:28 +0100 |
parents | f7a718bcb4da |
children | 1e8270c18edb |
comparison
equal
deleted
inserted
replaced
1011:f2c5d44a8db0 | 1012:2c1a0722ddb9 |
---|---|
313 @test InflatedLazyTensor(itm, I(2)) == InflatedLazyTensor(I(3,2), A, I(4,2)) | 313 @test InflatedLazyTensor(itm, I(2)) == InflatedLazyTensor(I(3,2), A, I(4,2)) |
314 @test InflatedLazyTensor(I(4), itm) == InflatedLazyTensor(I(4,3,2), A, I(4)) | 314 @test InflatedLazyTensor(I(4), itm) == InflatedLazyTensor(I(4,3,2), A, I(4)) |
315 | 315 |
316 @test InflatedLazyTensor(I(2), I(2), I(2)) isa InflatedLazyTensor # The constructor should always return its type. | 316 @test InflatedLazyTensor(I(2), I(2), I(2)) isa InflatedLazyTensor # The constructor should always return its type. |
317 end | 317 end |
318 | |
319 @testset "Pretty printing" begin | |
320 cases = [ | |
321 InflatedLazyTensor(I(4), ScalingTensor(2., (3,2)), I(2)) => ( | |
322 regular="I(4)⊗ScalingTensor{Float64}(2.0, (3, 2))⊗I(2)", | |
323 compact="I(4)⊗2.0*I(3,2)⊗I(2)" | |
324 ) | |
325 ] | |
326 | |
327 @testset "$tm" for (tm, r) ∈ cases | |
328 @test repr(MIME("text/plain"), tm) == r.regular | |
329 @test repr(MIME("text/plain"), tm, context=:compact=>true) == r.compact | |
330 end | |
331 end | |
318 end | 332 end |
319 | 333 |
320 @testset "LazyOuterProduct" begin | 334 @testset "LazyOuterProduct" begin |
321 A = ScalingTensor(2.0, (5,)) | 335 A = ScalingTensor(2.0, (5,)) |
322 B = ScalingTensor(3.0, (3,)) | 336 B = ScalingTensor(3.0, (3,)) |