@@ -24,28 +24,40 @@ vspaces = (ℙ^10, Rep[U₁]((0 => 20)), Rep[SU₂](1 // 2 => 10, 3 // 2 => 5, 5
2424 for V in (ℂ^ 2 , U1Space(0 => 1 , 1 => 1 ))
2525 O₁ = rand(T, V^ L, V^ L)
2626 O₂ = rand(T, space(O₁))
27+ O₃ = rand(real(T), space(O₁))
2728
2829 # create MPO and convert it back to see if it is the same
2930 mpo₁ = FiniteMPO(O₁) # type-unstable for now!
3031 mpo₂ = FiniteMPO(O₂)
32+ mpo₃ = FiniteMPO(O₃)
3133 @test convert(TensorMap, mpo₁) ≈ O₁
3234 @test convert(TensorMap, - mpo₂) ≈ - O₂
35+ @test convert(TensorMap, @constinferred complex(mpo₃)) ≈ complex(O₃)
3336
3437 # test scalar multiplication
3538 α = rand(T)
3639 @test convert(TensorMap, α * mpo₁) ≈ α * O₁
3740 @test convert(TensorMap, mpo₁ * α) ≈ O₁ * α
41+ @test α * mpo₃ ≈ α * complex(mpo₃)
3842
3943 # test addition and multiplication
4044 @test convert(TensorMap, mpo₁ + mpo₂) ≈ O₁ + O₂
45+ @test convert(TensorMap, mpo₁ + mpo₃) ≈ O₁ + O₃
4146 @test convert(TensorMap, mpo₁ * mpo₂) ≈ O₁ * O₂
47+ @test convert(TensorMap, mpo₁ * mpo₃) ≈ O₁ * O₃
4248
4349 # test application to a state
4450 ψ₁ = rand(T, domain(O₁))
51+ ψ₂ = rand(real(T), domain(O₂))
4552 mps₁ = FiniteMPS(ψ₁)
53+ mps₂ = FiniteMPS(ψ₂)
4654
4755 @test convert(TensorMap, mpo₁ * mps₁) ≈ O₁ * ψ₁
4856 @test mpo₁ * ψ₁ ≈ O₁ * ψ₁
57+ @test convert(TensorMap, mpo₃ * mps₁) ≈ O₃ * ψ₁
58+ @test mpo₃ * ψ₁ ≈ O₃ * ψ₁
59+ @test convert(TensorMap, mpo₁ * mps₂) ≈ O₁ * ψ₂
60+ @test mpo₁ * ψ₂ ≈ O₁ * ψ₂
4961
5062 @test dot(mps₁, mpo₁, mps₁) ≈ dot(ψ₁, O₁, ψ₁)
5163 @test dot(mps₁, mpo₁, mps₁) ≈ dot(mps₁, mpo₁ * mps₁)
0 commit comments