@@ -76,9 +76,7 @@ function MAK.truncate(
7676end
7777
7878function MAK. truncate (
79- :: typeof (left_null!),
80- (U, S):: Tuple{AbstractTensorMap, AbstractTensorMap} ,
81- strategy:: MatrixAlgebraKit.TruncationStrategy
79+ :: typeof (left_null!), (U, S):: NTuple{2, AbstractTensorMap} , strategy:: TruncationStrategy
8280 )
8381 extended_S = SectorDict (
8482 c => vcat (diagview (b), zeros (eltype (b), max (0 , size (b, 2 ) - size (b, 1 ))))
@@ -90,6 +88,40 @@ function MAK.truncate(
9088 truncate_domain! (Ũ, U, ind)
9189 return Ũ, ind
9290end
91+ function MAK. truncate (
92+ :: typeof (right_null!), (S, Vᴴ):: NTuple{2, AbstractTensorMap} , strategy:: TruncationStrategy
93+ )
94+ extended_S = SectorDict (
95+ c => vcat (diagview (b), zeros (eltype (b), max (0 , size (b, 1 ) - size (b, 2 ))))
96+ for (c, b) in blocks (S)
97+ )
98+ ind = MAK. findtruncated (extended_S, strategy)
99+ V_truncated = truncate_space (space (Vᴴ, 1 ), ind)
100+ Ṽᴴ = similar (Vᴴ, V_truncated ← domain (Vᴴ))
101+ truncate_codomain! (Ṽᴴ, Vᴴ, ind)
102+ return Ṽᴴ, ind
103+ end
104+
105+ # special case `NoTruncation` for null: should keep exact zeros due to rectangularity
106+ # need to specialize to avoid ambiguity with special case in MatrixAlgebraKit
107+ function MAK. truncate (
108+ :: typeof (left_null!), (U, S):: NTuple{2, AbstractTensorMap} , strategy:: NoTruncation
109+ )
110+ ind = SectorDict (c => (size (b, 2 ) + 1 ): size (b, 1 ) for (c, b) in blocks (S))
111+ V_truncated = truncate_space (space (S, 1 ), ind)
112+ Ũ = similar (U, codomain (U) ← V_truncated)
113+ truncate_domain! (Ũ, U, ind)
114+ return Ũ, ind
115+ end
116+ function MAK. truncate (
117+ :: typeof (right_null!), (S, Vᴴ):: NTuple{2, AbstractTensorMap} , strategy:: NoTruncation
118+ )
119+ 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)
121+ Ṽᴴ = similar (Vᴴ, V_truncated ← domain (Vᴴ))
122+ truncate_codomain! (Ṽᴴ, Vᴴ, ind)
123+ return Ṽᴴ, ind
124+ end
93125
94126for f! in (:eig_trunc! , :eigh_trunc! )
95127 @eval function MAK. truncate (
0 commit comments