Skip to content

Commit f124626

Browse files
committed
Change trunctol to use TruncationKeepBelow
1 parent 2d6443e commit f124626

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/interface/truncation.jl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,6 @@ struct TruncationKeepFiltered{F} <: TruncationStrategy
6969
filter::F
7070
end
7171

72-
"""
73-
trunctol(val::Real; by=abs)
74-
75-
Truncation strategy to discard the values that are smaller than `val` according to `by`.
76-
"""
77-
trunctol(val::Real; by=abs) = TruncationKeepFiltered((val) by)
78-
7972
"""
8073
truncabove(val::Real; by=abs)
8174
@@ -114,6 +107,15 @@ function TruncationKeepBelow(atol::Real, rtol::Real, p::Real=2, by=abs)
114107
return TruncationKeepBelow(promote(atol, rtol)..., p, by)
115108
end
116109

110+
"""
111+
trunctol(; atol::Real, rtol::Real, p::Real=2, by=abs)
112+
113+
Truncation strategy to discard all values that satisfy `by(val) < max(atol, rtol * norm(values))`.
114+
"""
115+
function trunctol(; atol::Real=0, rtol::Real=0, p::Real=2, by=abs)
116+
return TruncationKeepBelow(; atol, rtol, p, by)
117+
end
118+
117119
"""
118120
TruncationIntersection(trunc::TruncationStrategy, truncs::TruncationStrategy...)
119121

0 commit comments

Comments
 (0)