Skip to content

Commit e5d3887

Browse files
deprecate vecarr_to_arr
1 parent a927799 commit e5d3887

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ which act appropriate. Points to note are:
3434
- The length is the number of vectors, or `length(A.u)` where `u` is the vector of arrays.
3535
- Iteration follows the linear index and goes over the vectors
3636

37-
Additionally, the `vecarr_to_arr(VA::AbstractVectorOfArray)` function is provided which transforms
37+
Additionally, the `convert(Array,VA::AbstractVectorOfArray)` function is provided which transforms
3838
the `VectorOfArray` into a matrix/tensor. Also, `vecarr_to_vectors(VA::AbstractVectorOfArray)`
3939
returns a vector of the series for each component, that is `A[i,:]` for each `i`.
4040
A plot recipe is provided which plots the `A[i,:]` series.
@@ -86,11 +86,14 @@ A recursive `copy!` function. Acts like a `deepcopy!` on arrays of arrays, but
8686
like `copy!` on arrays of scalars.
8787

8888
```julia
89-
vecarr_to_arr(vecvec)
89+
convert(Array,vecvec)
9090
```
9191

92-
Takes in a vector of arrays, returns an array of dimension one greater than the
93-
original elements. Works on `AbstractVectorOfArray`.
92+
Technically just a Base fallback that works well. Takes in a vector of arrays,
93+
returns an array of dimension one greater than the original elements.
94+
Works on `AbstractVectorOfArray`. If the `vecvec` is ragged, i.e. not all of the
95+
elements are the same, then it uses the size of the first element to determine
96+
the conversion.
9497

9598
```julia
9699
vecvecapply(f::Base.Callable,v)

src/vector_of_array.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ function Base.append!{T, N}(VA::AbstractVectorOfArray{T, N}, new_item::AbstractV
5252
end
5353

5454
# conversion tools
55-
vecarr_to_arr(VA::AbstractVectorOfArray) = cat(length(size(VA)), VA.u...)
56-
vecarr_to_arr{T<:AbstractArray}(VA::Vector{T}) = cat(length(size(VA[1]))+1,VA...)
55+
@deprecate vecarr_to_arr(VA::AbstractVectorOfArray) convert(Array,VA)
56+
@deprecate vecarr_to_arr{T<:AbstractArray}(VA::Vector{T}) convert(Array,VA)
5757
vecarr_to_vectors(VA::AbstractVectorOfArray) = [VA[i,:] for i in eachindex(VA[1])]
5858

5959
# make it show just like its data
@@ -76,10 +76,10 @@ end
7676

7777
# plot recipes
7878
@recipe function f(VA::AbstractVectorOfArray)
79-
vecarr_to_vectors(VA)
79+
convert(Array,VA)
8080
end
8181
@recipe function f(VA::AbstractDiffEqArray)
82-
A = vecarr_to_vectors(VA)
82+
A = convert(Array,VA)
8383
VA.t,A
8484
end
8585

test/interface_tests.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using RecursiveArrayTools, Base.Test
12

23
recs = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
34
testva = VectorOfArray(recs)
@@ -36,8 +37,8 @@ testva[4, 9] # == testva.data[9][4]
3637
recs = [rand(10, 7) for i = 1:8]
3738
testva = VectorOfArray(recs)
3839
testa = cat(3, recs...)
39-
@test vecarr_to_arr(testva) == testa
40+
@test convert(Array,testva) == testa
4041

4142
recs = [[1, 2, 3], [3 5; 6 7], [8, 9, 10, 11]]
4243
testva = VectorOfArray(recs)
43-
@test_throws DimensionMismatch vecarr_to_arr(testva)
44+
@test size(convert(Array,testva)) == (3,3)

0 commit comments

Comments
 (0)