Skip to content

Commit 995f805

Browse files
committed
Add tests on convergencecriterion
1 parent 0f55f10 commit 995f805

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

test/test_tensorci2.jl

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,4 +394,56 @@ import QuanticsGrids as QD
394394

395395
@test vals_reconst vals_ref
396396
end
397+
398+
@testset "convergencecriterion" begin
399+
let
400+
ranks = [1, 2]
401+
errors = [1e-2, 1e-5]
402+
nglobalpivot = [0, 0]
403+
tol = 1e-4
404+
maxbonddim = 4
405+
ncheckhistory = 3
406+
@test TCI.convergencecriterion(ranks, errors, nglobalpivot, tol, maxbonddim, ncheckhistory) == false
407+
end
408+
409+
let
410+
ranks = [1, 2, 2, 2]
411+
errors = [1e-2, 1e-5, 1e-5, 1e-5]
412+
nglobalpivot = [0, 0, 0, 0]
413+
tol = 1e-4
414+
maxbonddim = 4
415+
ncheckhistory = 3
416+
@test TCI.convergencecriterion(ranks, errors, nglobalpivot, tol, maxbonddim, ncheckhistory) == true
417+
end
418+
419+
let
420+
ranks = [1, 2, 2, 2]
421+
errors = [1e-2, 1e-2, 1e-5, 1e-5]
422+
nglobalpivot = [0, 0, 0, 0]
423+
tol = 1e-4
424+
maxbonddim = 4
425+
ncheckhistory = 3
426+
@test TCI.convergencecriterion(ranks, errors, nglobalpivot, tol, maxbonddim, ncheckhistory) == false
427+
end
428+
429+
let
430+
ranks = [1, 2, 2, 2]
431+
errors = [1e-2, 1e-2, 1e-2, 1e-2]
432+
nglobalpivot = [0, 0, 0, 0]
433+
tol = 1e-4
434+
maxbonddim = 2
435+
ncheckhistory = 3
436+
@test TCI.convergencecriterion(ranks, errors, nglobalpivot, tol, maxbonddim, ncheckhistory) == true
437+
end
438+
439+
let
440+
ranks = [1, 2, 2, 2]
441+
errors = [1e-2, 1e-2, 1e-2, 1e-2]
442+
nglobalpivot = [0, 1, 1, 1]
443+
tol = 1e-4
444+
maxbonddim = 2
445+
ncheckhistory = 3
446+
@test TCI.convergencecriterion(ranks, errors, nglobalpivot, tol, maxbonddim, ncheckhistory) == true
447+
end
448+
end
397449
end

0 commit comments

Comments
 (0)