Skip to content

Commit 8f6795a

Browse files
committed
more nullspace tests and fixes
1 parent 8a07a69 commit 8f6795a

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/factorizations/truncation.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function MAK.truncate(
7979
::typeof(left_null!), (U, S)::NTuple{2, AbstractTensorMap}, strategy::TruncationStrategy
8080
)
8181
extended_S = SectorDict(
82-
c => vcat(diagview(b), zeros(eltype(b), max(0, size(b, 2) - size(b, 1))))
82+
c => vcat(diagview(b), zeros(eltype(b), max(0, size(b, 1) - size(b, 2))))
8383
for (c, b) in blocks(S)
8484
)
8585
ind = MAK.findtruncated(extended_S, strategy)
@@ -92,11 +92,11 @@ function MAK.truncate(
9292
::typeof(right_null!), (S, Vᴴ)::NTuple{2, AbstractTensorMap}, strategy::TruncationStrategy
9393
)
9494
extended_S = SectorDict(
95-
c => vcat(diagview(b), zeros(eltype(b), max(0, size(b, 1) - size(b, 2))))
95+
c => vcat(diagview(b), zeros(eltype(b), max(0, size(b, 2) - size(b, 1))))
9696
for (c, b) in blocks(S)
9797
)
9898
ind = MAK.findtruncated(extended_S, strategy)
99-
V_truncated = truncate_space(space(Vᴴ, 1), ind)
99+
V_truncated = truncate_space(dual(space(S, 2)), ind)
100100
Ṽᴴ = similar(Vᴴ, V_truncated domain(Vᴴ))
101101
truncate_codomain!(Ṽᴴ, Vᴴ, ind)
102102
return Ṽᴴ, ind
@@ -117,7 +117,7 @@ function MAK.truncate(
117117
::typeof(right_null!), (S, Vᴴ)::NTuple{2, AbstractTensorMap}, strategy::NoTruncation
118118
)
119119
ind = SectorDict(c => (size(b, 1) + 1):size(b, 2) for (c, b) in blocks(S))
120-
V_truncated = truncate_space(space(Vᴴ, 1), ind)
120+
V_truncated = truncate_space(dual(space(S, 2)), ind)
121121
Ṽᴴ = similar(Vᴴ, V_truncated domain(Vᴴ))
122122
truncate_codomain!(Ṽᴴ, Vᴴ, ind)
123123
return Ṽᴴ, ind

test/tensors/factorizations.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,17 @@ for V in spacelist
206206
@test isisometric(N)
207207
@test norm(N' * t) 0 atol = 100 * eps(norm(t))
208208

209+
N = @constinferred left_null(t; trunc = (; atol = 100 * eps(norm(t))))
210+
@test isisometric(N)
211+
@test norm(N' * t) 0 atol = 100 * eps(norm(t))
212+
209213
Nᴴ = @constinferred right_null(t; alg = :svd)
210214
@test isisometric(Nᴴ; side = :right)
211215
@test norm(t * Nᴴ') 0 atol = 100 * eps(norm(t))
216+
217+
Nᴴ = @constinferred right_null(t; trunc = (; atol = 100 * eps(norm(t))))
218+
@test isisometric(Nᴴ; side = :right)
219+
@test norm(t * Nᴴ') 0 atol = 100 * eps(norm(t))
212220
end
213221

214222
# empty tensor

0 commit comments

Comments
 (0)