Skip to content

Commit 76e76d4

Browse files
committed
changed signature of compress method
1 parent c38bb01 commit 76e76d4

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/tensortrain.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ function tensortrain(tci)
5656
return TensorTrain(tci)
5757
end
5858

59-
function recompress!(
60-
tt::AbstractTensorTrain{V};
61-
tolerance::Float64=1e-12, maxbonddim=typemax(Int),
62-
method::Symbol=:LU
59+
function compress!(
60+
tt::AbstractTensorTrain{V},
61+
method::Symbol=:LU;
62+
tolerance::Float64=1e-12,
63+
maxbonddim=typemax(Int)
6364
) where {V}
6465
function factorize(A::Matrix{V})
6566
if method === :LU

test/test_tensortrain.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ using Optim
2525

2626
for method in [:LU, :CI, :SVD]
2727
ttcompressed = deepcopy(tt)
28-
TCI.recompress!(ttcompressed; maxbonddim=5, tolerance=1e-2, method)
28+
TCI.compress!(ttcompressed, method; maxbonddim=5)
2929
@test TCI.rank(ttcompressed) <= 5
3030
end
31+
32+
for method in [:LU, :CI, :SVD]
33+
ttcompressed = deepcopy(tt)
34+
TCI.compress!(ttcompressed, method; tolerance=1.0)
35+
@test TCI.rank(ttcompressed) <= TCI.rank(tt)
36+
end
3137
end
3238

3339
@testset "batchevaluate" begin

0 commit comments

Comments
 (0)