Skip to content

Commit 01e8df9

Browse files
authored
Merge branch 'main' into ortho_trunc
2 parents 022ab9a + 2364e25 commit 01e8df9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/truncate.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using MatrixAlgebraKit
22
using Test
33
using TestExtras
44
using MatrixAlgebraKit: NoTruncation, TruncationIntersection, TruncationKeepAbove,
5-
TruncationStrategy
5+
TruncationStrategy, findtruncated
66

77
@testset "truncate" begin
88
trunc = @constinferred TruncationStrategy()
@@ -26,4 +26,9 @@ using MatrixAlgebraKit: NoTruncation, TruncationIntersection, TruncationKeepAbov
2626
@test trunc == truncrank(10) & TruncationKeepAbove(1e-2, 1e-3)
2727
@test trunc.components[1] == truncrank(10)
2828
@test trunc.components[2] == TruncationKeepAbove(1e-2, 1e-3)
29+
30+
values = [1, 0.9, 0.5, 0.3, 0.01]
31+
@test @constinferred(findtruncated(values, truncrank(2))) == [1, 2]
32+
@test @constinferred(findtruncated(values, truncrank(2; rev=false))) == [5, 4]
33+
@test @constinferred(findtruncated(values, truncrank(2; by=-))) == [5, 4]
2934
end

0 commit comments

Comments
 (0)