Skip to content

Commit cbd7315

Browse files
committed
rm comments
1 parent 5d7234f commit cbd7315

File tree

3 files changed

+1
-139
lines changed

3 files changed

+1
-139
lines changed

Project.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@ version = "0.1.0"
77
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
88
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
99
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
10-
# NamedDims = "356022a1-0364-5f58-8944-0da4b18d706f"
11-
# OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
1210

1311
[compat]
1412
ChainRulesCore = "1"
1513
Compat = "3.46, 4.2"
16-
# NamedDims = "0.2.16, 0.3, 1.0" # try to remove
17-
# OffsetArrays = "1" # try to remove
1814
julia = "1.6"
1915

2016
[extras]

src/LazyStack.jl

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ _size(A) = Base.size(A)
2929
_size(t::Tuple) = tuple(length(t))
3030
_size(t::NamedTuple) = tuple(length(t))
3131

32-
# similar_vector(x::AbstractArray, n::Int) = similar(x, n::Int)
33-
# similar_vector(x::Tuple, n::Int) = Vector{eltype(x)}(undef, n::Int)
34-
# similar_vector(x::NamedTuple, n::Int) = Vector{eltype(x)}(undef, n::Int)
35-
36-
# eltype(x::Tuple) = Base.promote_type(x...) # to match choice below
37-
# eltype(x::NamedTuple) = Base.promote_type(x...)
3832

3933
#===== Slices =====#
4034

@@ -163,15 +157,6 @@ end
163157

164158
#===== Iteration =====#
165159

166-
# ITERS = [:Flatten, :Drop, :Filter]
167-
# for iter in ITERS
168-
# @eval _ndims(::Iterators.$iter) = 1
169-
# end
170-
# _ndims(gen::Base.Generator) = _ndims(gen.iter)
171-
# _ndims(zed::Iterators.Zip) = maximum(ndims, zed.is)
172-
#
173-
# similar_vector(x, n::Int) = throw(ArgumentError())
174-
175160
"""
176161
lazystack(::Generator)
177162
lazystack(::Array{T}, ::Array{S}, ...)
@@ -207,64 +192,6 @@ Always uses `Base.stack`.
207192
lazystack(fun::Function, iter) = Compat.stack(fun, iter)
208193
lazystack(fun::Function, iters...) = Compat.stack(fun, iters...)
209194

210-
# #===== Offset =====#
211-
#
212-
# using OffsetArrays
213-
#
214-
# no_offsets(a) = a
215-
# no_offsets(a::OffsetArray) = parent(a)
216-
#
217-
# rewrap_like(A, a) = A
218-
# function rewrap_like(A, a::OffsetArray)
219-
# B = rewrap_like(A, parent(a))
220-
# OffsetArray(B, _axes(a)..., _axes(A, _ndims(A)))
221-
# end
222-
#
223-
# no_wraps_or_offsets(a) = no_offsets(no_wraps(a))
224-
#
225-
# #===== NamedDims =====#
226-
#
227-
# using NamedDims
228-
#
229-
# ensure_named(a::AbstractArray, L::Tuple) = NamedDimsArray(a, L)
230-
# ensure_named(a::NamedDimsArray, L::Tuple) = refine_names(a, L)
231-
#
232-
# # array of arrays
233-
# stack(xs::NamedDimsArray{<:Any,<:AbstractArray}) =
234-
# ensure_named(stack(parent(xs)), getnames(xs))
235-
# stack(x::AT) where {AT <: AbstractArray{<:NamedDimsArray{L,T,IN},ON}} where {T,IN,ON,L} =
236-
# ensure_named(Stacked{T, IN+ON, AT}(x), getnames(x))
237-
#
238-
# getnames(xs::AbstractArray{<:AbstractArray}) =
239-
# (dimnames(eltype(xs))..., dimnames(xs)...)
240-
#
241-
# # tuple of arrays
242-
# stack(x::AT) where {AT <: Tuple{Vararg{NamedDimsArray{L,T,IN}}}} where {T,IN,L} =
243-
# ensure_named(stack(map(parent, x)), getnames(x))
244-
#
245-
# getnames(xs::Tuple{Vararg{<:NamedDimsArray}}) =
246-
# (dimnames(first(xs))..., :_)
247-
#
248-
# function rewrap_like(A, a::NamedDimsArray{L}) where {L}
249-
# B = rewrap_like(A, parent(a))
250-
# ensure_named(B, (L..., ntuple(_ -> :_, _ndims(A) - _ndims(a))...))
251-
# end
252-
#
253-
# no_wraps(a) = a
254-
# no_wraps(a::NamedDimsArray) = no_wraps(parent(a))
255-
#
256-
# """
257-
# stack(name, things...)
258-
#
259-
# If you give one `name::Symbol` before the pieces to be stacked,
260-
# this will be the name of the last dimension of the resulting `NamedDimsArray`.
261-
# (Names attached to slices, and to containers, should also be preserved.)
262-
# """
263-
# function LazyStack.stack(s::Symbol, args...)
264-
# data = stack(args...)
265-
# name_last = ntuple(d -> d==_ndims(data) ? s : :_, _ndims(data))
266-
# ensure_named(data, name_last)
267-
# end
268195

269196
#===== Gradients =====#
270197

test/runtests.jl

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Test, LazyStack
2-
using OffsetArrays # , NamedDims
2+
using OffsetArrays
33

44
@testset "basics" begin
55

@@ -97,32 +97,6 @@ end
9797
lazystack(acc) isa Array{Int}
9898

9999
end
100-
# @testset "names" begin
101-
#
102-
# nin = [NamedDimsArray(ones(3), :a) for i in 1:4]
103-
# @test dimnames(lazystack(nin)) == (:a, :_)
104-
# @test dimnames(lazystack(nin...)) == (:a, :_)
105-
# @test dimnames(lazystack(:b, nin)) == (:a, :b)
106-
# @test dimnames(lazystack(:b, nin...)) == (:a, :b)
107-
# @test lazystack(nin).data.slices[1] isa NamedDimsArray # vector container untouched,
108-
# @test lazystack(nin...).data.slices[1] isa Array # but tuple container cleaned up.
109-
#
110-
# nout = NamedDimsArray([ones(3) for i in 1:4], :b)
111-
# @test dimnames(lazystack(nout)) == (:_, :b)
112-
# @test dimnames(lazystack(:b, nout)) == (:_, :b)
113-
# @test_throws Exception lazystack(:c, nout)
114-
#
115-
# nboth = NamedDimsArray([NamedDimsArray(ones(3), :a) for i in 1:4], :b)
116-
# @test dimnames(lazystack(nboth)) == (:a, :b)
117-
#
118-
# ngen = (NamedDimsArray(ones(3), :a) for i in 1:4)
119-
# @test dimnames(lazystack(ngen)) == (:a, :_)
120-
# @test dimnames(lazystack(:b, ngen)) == (:a, :b)
121-
#
122-
# nmat = [NamedDimsArray(ones(3), :a) for i in 1:3, j in 1:4]
123-
# @test dimnames(lazystack(:c, nmat)) == (:a, :_, :c)
124-
#
125-
# end
126100
@testset "offset" begin
127101

128102
oin = [OffsetArray(ones(3), 3:5) for i in 1:4]
@@ -141,29 +115,6 @@ end
141115
@test axes(lazystack(ogen)) == (3:5, 1:4)
142116

143117
end
144-
# @testset "named offset" begin
145-
#
146-
# noin = [NamedDimsArray(OffsetArray(ones(3), 3:5), :a) for i in 1:4]
147-
# @test dimnames(lazystack(noin)) == (:a, :_)
148-
# @test dimnames(lazystack(noin...)) == (:a, :_)
149-
# @test dimnames(lazystack(:b, noin)) == (:a, :b)
150-
# @test dimnames(lazystack(:b, noin...)) == (:a, :b)
151-
# @test axes(lazystack(noin)) == (3:5, 1:4)
152-
# @test axes(lazystack(noin...)) == (3:5, 1:4)
153-
#
154-
# noout = NamedDimsArray(OffsetArray([ones(3) for i in 1:4], 11:14), :b)
155-
# @test dimnames(lazystack(noout)) == (:_, :b)
156-
# @test dimnames(lazystack(:b, noout)) == (:_, :b)
157-
# @test_throws Exception lazystack(:c, noout)
158-
# @test axes(lazystack(noout)) == (1:3, 11:14)
159-
# @test axes(copy(lazystack(noout))) == (1:3, 11:14)
160-
#
161-
# nogen = (NamedDimsArray(OffsetArray([3,4,5], 3:5), :a) for i in 1:4)
162-
# @test dimnames(lazystack(nogen)) == (:a, :_)
163-
# @test dimnames(lazystack(:b, nogen)) == (:a, :b)
164-
# @test axes(lazystack(nogen)) == (3:5, 1:4)
165-
#
166-
# end
167118
@testset "push!" begin
168119

169120
v34 = [rand(3) for i in 1:4]
@@ -200,15 +151,6 @@ end
200151
@test raggedstack(OffsetArray(fill(n,4), rand(-2:2)) for n in 1:10; fill=NaN) isa OffsetArray{Real,2}
201152

202153
end
203-
# @testset "vlazystack" begin
204-
#
205-
# v34 = [rand(3) for i in 1:4]
206-
# @test LazyStack.vlazystack(v34) == reduce(vcat, v34)
207-
#
208-
# g234 = (ones(2) .* (10i + j) for i in 1:3, j in 1:4)
209-
# @test LazyStack.vlazystack(g234) == reduce(vcat, collect(g234))
210-
#
211-
# end
212154
@testset "ragged" begin
213155

214156
@test raggedstack([1,2], 1:3) == [1 1; 2 2; 0 3]
@@ -217,9 +159,6 @@ end
217159
@test raggedstack(1:2, OffsetArray([2,3], +1)) == [1 0; 2 2; 0 3]
218160
@test raggedstack(1:2, OffsetArray([0.1,1], -1)) == OffsetArray([0 0.1; 1 1.0; 2 0],-1,0)
219161

220-
# @test dimnames(raggedstack(:b, 1:2, [3,4,5], fill=NaN)) == (:_, :b)
221-
# @test dimnames(raggedstack(:b, NamedDimsArray(1:2, :a), OffsetArray([2,3], +1))) == (:a, :b)
222-
223162
end
224163
@testset "tuple functions" begin
225164

0 commit comments

Comments
 (0)