diff --git a/src/Iteration/ColumnIterator.jl b/src/Iteration/ColumnIterator.jl deleted file mode 100644 index fee3c55..0000000 --- a/src/Iteration/ColumnIterator.jl +++ /dev/null @@ -1,29 +0,0 @@ -# iterator over the columns of a matrix -struct ColumnIterator{T<:AbstractMatrix} - matrix::T -end - -function Base.length(it::ColumnIterator) - return size(it.matrix, 2) -end - -function Base.eltype(::Type{<:ColumnIterator{<:AbstractMatrix{N}}}) where {N} - return AbstractVector{N} -end - -function Base.eltype(::Type{<:ColumnIterator{<:Matrix{N}}}) where {N} - return Vector{N} -end - -function Base.eltype(::Type{<:ColumnIterator{<:SparseMatrixCSC{N}}}) where {N} - return SparseVector{N} -end - -function Base.iterate(it::ColumnIterator, state=0) - if state == length(it) - return nothing - end - state += 1 - column = it.matrix[:, state] - return (column, state) -end diff --git a/src/Iteration/Iteration.jl b/src/Iteration/Iteration.jl index 53094e7..a62754e 100644 --- a/src/Iteration/Iteration.jl +++ b/src/Iteration/Iteration.jl @@ -7,13 +7,12 @@ module Iteration using SparseArrays -export EmptyIterator, SingletonIterator, VectorIterator, ColumnIterator, +export EmptyIterator, SingletonIterator, VectorIterator, StrictlyIncreasingIndices, NondecreasingIndices, BitvectorIterator include("EmptyIterator.jl") include("SingletonIterator.jl") include("VectorIterator.jl") -include("ColumnIterator.jl") include("StrictlyIncreasingIndices.jl") include("NondecreasingIndices.jl") include("BitvectorIterator.jl") diff --git a/test/Iteration/ColumnIterator.jl b/test/Iteration/ColumnIterator.jl deleted file mode 100644 index d7c045c..0000000 --- a/test/Iteration/ColumnIterator.jl +++ /dev/null @@ -1,16 +0,0 @@ -using ReachabilityBase.Iteration - -ci = ColumnIterator([1 2; 3 4]) -@test length(ci) == 2 -@test eltype(ci) == Vector{Int} -@test collect(ci) == [[1, 3], [2, 4]] - -ci = ColumnIterator(sparse([1 0 0; 0 0 4])) -@test length(ci) == 3 -@test eltype(ci) == SparseVector{Int} -@test collect(ci) == [sparsevec([1, 0]), sparsevec([0, 0]), sparsevec([0, 4])] - -ci = ColumnIterator(Diagonal(1:4)) -@test length(ci) == 4 -@test eltype(ci) == AbstractVector{Int} -@test collect(ci) == [[1, 0, 0, 0], [0, 2, 0, 0], [0, 0, 3, 0], [0, 0, 0, 4]] diff --git a/test/runtests.jl b/test/runtests.jl index da6500b..4872166 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -7,9 +7,6 @@ seed!(1234) # fix RNG seed for reproducibility @time @testset "Comparison" begin include("Comparison/comparison.jl") end -@time @testset "Iteration.ColumnIterator" begin - include("Iteration/ColumnIterator.jl") -end @time @testset "Iteration" begin include("Iteration/StrictlyIncreasingIndices.jl") end