Skip to content

Commit 79e9187

Browse files
committed
increase cov
1 parent 9ed46ff commit 79e9187

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/InfiniteLinearAlgebra.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ end
7777
_chop!(_, c::AbstractVector, tol::Real) = resize!(c, choplength(c, tol))
7878
_chop!(ax::BlockedUnitRange, c::AbstractVector, tol::Real) = resize!(c, findblock(ax, choplength(c, tol)))
7979

80-
chop!(c::AbstractVector, tol::Real) = _chop!(axes(c,1), c, tol)
80+
chop!(c::AbstractVector{T}, tol::Real=zero(real(T))) where T = _chop!(axes(c,1), c, tol)
8181

82-
function chop(A::AbstractMatrix, tol)
82+
function chop(A::AbstractMatrix{T}, tol::Real=zero(real(T))) where T
8383
for k = size(A,1):-1:1
8484
if norm(view(A,k,:))>tol
8585
A=A[1:k,:]

test/runtests.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using InfiniteLinearAlgebra, BlockBandedMatrices, BlockArrays, BandedMatrices, I
22
MatrixFactorizations, ArrayLayouts, LinearAlgebra, Random, LazyBandedMatrices, StaticArrays
33
import InfiniteLinearAlgebra: qltail, toeptail, tailiterate , tailiterate!, tail_de, ql_X!,
44
InfToeplitz, PertToeplitz, TriToeplitz, InfBandedMatrix, InfBandCartesianIndices,
5-
rightasymptotics, QLHessenberg, ConstRows, PertConstRows,
5+
rightasymptotics, QLHessenberg, ConstRows, PertConstRows, chop, chop!,
66
BandedToeplitzLayout, PertToeplitzLayout, TridiagonalToeplitzLayout, BidiagonalToeplitzLayout
77
import Base: BroadcastStyle
88
import BlockArrays: _BlockArray
@@ -16,11 +16,17 @@ import LazyBandedMatrices: BroadcastBandedBlockBandedLayout, BroadcastBandedLayo
1616
@testset "chop" begin
1717
a = randn(5)
1818
b = [a; zeros(5)]
19-
InfiniteLinearAlgebra.chop!(b, eps())
19+
chop!(b, eps())
2020
@test b == a
2121

22+
@test isempty(chop!([0]))
23+
2224
A = randn(5,5)
23-
@test InfiniteLinearAlgebra.chop([A zeros(5,2); zeros(2,5) zeros(2,2)],eps()) == A
25+
@test chop([A zeros(5,2); zeros(2,5) zeros(2,2)],eps()) == A
26+
27+
c = PseudoBlockArray([randn(5); zeros(10)], (blockedrange(1:5),))
28+
d = chop!(c, 0);
29+
@test length(d) == 6
2430
end
2531

2632
include("test_infconv.jl")

0 commit comments

Comments
 (0)