@@ -55,33 +55,33 @@ specified field arrays.
55
55
56
56
```julia-repl
57
57
julia> StructArray{ComplexF64}(([1.0, 2.0], [3.0, 4.0]))
58
- 2-element StructArray(::Array {Float64,1 }, ::Array {Float64,1 }) with eltype Complex{Float64}:
58
+ 2-element StructArray(::Vector {Float64}, ::Vector {Float64}) with eltype Complex{Float64}:
59
59
1.0 + 3.0im
60
60
2.0 + 4.0im
61
61
62
62
julia> StructArray{ComplexF64}(re=[1.0, 2.0], im=[3.0, 4.0])
63
- 2-element StructArray(::Array {Float64,1 }, ::Array {Float64,1 }) with eltype Complex{Float64}:
63
+ 2-element StructArray(::Vector {Float64}, ::Vector {Float64}) with eltype Complex{Float64}:
64
64
1.0 + 3.0im
65
65
2.0 + 4.0im
66
66
```
67
67
68
68
Any `AbstractArray` can be used as a field array
69
69
```julia-repl
70
70
julia> StructArray{Complex{Int64}}(([1, 2], 3:4))
71
- 2-element StructArray(::Array {Int64,1 }, ::UnitRange{Int64}) with eltype Complex{Int64}:
71
+ 2-element StructArray(::Vector {Int64}, ::UnitRange{Int64}) with eltype Complex{Int64}:
72
72
1 + 3im
73
73
2 + 4im
74
74
```
75
75
76
76
If no element type `T` is provided, a `Tuple` or `NamedTuple` is used:
77
77
```julia-repl
78
78
julia> StructArray((zeros(2,2), ones(2,2)))
79
- 2×2 StructArray(::Array {Float64,2 }, ::Array {Float64,2 }) with eltype Tuple{Float64,Float64}:
79
+ 2×2 StructArray(::Matrix {Float64}, ::Matrix {Float64}) with eltype Tuple{Float64,Float64}:
80
80
(0.0, 1.0) (0.0, 1.0)
81
81
(0.0, 1.0) (0.0, 1.0)
82
82
83
83
julia> StructArray(a=zeros(2,2), b=ones(2,2))
84
- 2×2 StructArray(::Array {Float64,2 }, ::Array {Float64,2 }) with eltype NamedTuple{(:a, :b),Tuple{Float64,Float64}}:
84
+ 2×2 StructArray(::Matrix {Float64}, ::Matrix {Float64}) with eltype NamedTuple{(:a, :b),Tuple{Float64,Float64}}:
85
85
(a = 0.0, b = 1.0) (a = 0.0, b = 1.0)
86
86
(a = 0.0, b = 1.0) (a = 0.0, b = 1.0)
87
87
```
@@ -120,25 +120,25 @@ recursively convert fields of type `FT` to `StructArray`s.
120
120
121
121
```julia-repl
122
122
julia> X = [1.0 2.0; 3.0 4.0]
123
- 2×2 Array {Float64,2 }:
123
+ 2×2 Matrix {Float64}:
124
124
1.0 2.0
125
125
3.0 4.0
126
126
127
127
julia> StructArray{Complex{Float64}}(X; dims=1)
128
- 2-element StructArray(view(::Array {Float64,2 }, 1, :), view(::Array {Float64,2 }, 2, :)) with eltype Complex{Float64}:
128
+ 2-element StructArray(view(::Matrix {Float64}, 1, :), view(::Matrix {Float64}, 2, :)) with eltype Complex{Float64}:
129
129
1.0 + 3.0im
130
130
2.0 + 4.0im
131
131
132
132
julia> StructArray{Complex{Float64}}(X; dims=2)
133
- 2-element StructArray(view(::Array {Float64,2 }, :, 1), view(::Array {Float64,2 }, :, 2)) with eltype Complex{Float64}:
133
+ 2-element StructArray(view(::Matrix {Float64}, :, 1), view(::Matrix {Float64}, :, 2)) with eltype Complex{Float64}:
134
134
1.0 + 2.0im
135
135
3.0 + 4.0im
136
136
```
137
137
138
138
By default, fields will be unwrapped until they match the element type of the array:
139
139
```julia-repl
140
140
julia> StructArray{Tuple{Float64,Complex{Float64}}}(rand(3,2); dims=1)
141
- 2-element StructArray(view(::Array {Float64,2 }, 1, :), StructArray(view(::Array {Float64,2 }, 2, :), view(::Array {Float64,2 }, 3, :))) with eltype Tuple{Float64,Complex{Float64}}:
141
+ 2-element StructArray(view(::Matrix {Float64}, 1, :), StructArray(view(::Matrix {Float64}, 2, :), view(::Matrix {Float64}, 3, :))) with eltype Tuple{Float64,Complex{Float64}}:
142
142
(0.004767505234193781, 0.27949621887414566 + 0.9039320635041561im)
143
143
(0.41853472213051335, 0.5760165160827859 + 0.9782723869433818im)
144
144
```
@@ -195,7 +195,7 @@ recursively convert arrays of element type `T` to `StructArray`s.
195
195
196
196
```julia-repl
197
197
julia> StructArray{ComplexF64}(undef, (2,3))
198
- 2×3 StructArray(::Array {Float64,2 }, ::Array {Float64,2 }) with eltype Complex{Float64}:
198
+ 2×3 StructArray(::Matrix {Float64}, ::Matrix {Float64}) with eltype Complex{Float64}:
199
199
2.3166e-314+2.38405e-314im 2.39849e-314+2.38405e-314im 2.41529e-314+2.38405e-314im
200
200
2.31596e-314+2.41529e-314im 2.31596e-314+2.41529e-314im 2.31596e-314+NaN*im
201
201
```
@@ -222,12 +222,12 @@ recursively convert arrays of element type `T` to `StructArray`s.
222
222
223
223
```julia-repl
224
224
julia> A = rand(ComplexF32, 2,2)
225
- 2×2 Array {Complex{Float32},2 }:
225
+ 2×2 Matrix {Complex{Float32}}:
226
226
0.694399+0.94999im 0.422804+0.891131im
227
227
0.101001+0.33644im 0.632468+0.811319im
228
228
229
229
julia> StructArray(A)
230
- 2×2 StructArray(::Array {Float32,2 }, ::Array {Float32,2 }) with eltype Complex{Float32}:
230
+ 2×2 StructArray(::Matrix {Float32}, ::Matrix {Float32}) with eltype Complex{Float32}:
231
231
0.694399+0.94999im 0.422804+0.891131im
232
232
0.101001+0.33644im 0.632468+0.811319im
233
233
```
@@ -236,7 +236,7 @@ julia> StructArray(A)
236
236
237
237
```julia-repl
238
238
julia> StructArray((1, Complex(i, j)) for i = 1:3, j = 2:4)
239
- 3×3 StructArray(::Array {Int64,2 }, ::Array {Complex{Int64},2 }) with eltype Tuple{Int64,Complex{Int64}}:
239
+ 3×3 StructArray(::Matrix {Int64}, ::Matrix {Complex{Int64}}) with eltype Tuple{Int64,Complex{Int64}}:
240
240
(1, 1+2im) (1, 1+3im) (1, 1+4im)
241
241
(1, 2+2im) (1, 2+3im) (1, 2+4im)
242
242
(1, 3+2im) (1, 3+3im) (1, 3+4im)
@@ -246,7 +246,7 @@ julia> StructArray((1, Complex(i, j)) for i = 1:3, j = 2:4)
246
246
247
247
```julia-repl
248
248
julia> StructArray((1, Complex(i, j)) for i = 1:3, j = 2:4; unwrap = T -> !(T<:Real))
249
- 3×3 StructArray(::Array {Int64,2 }, StructArray(::Array {Int64,2 }, ::Array {Int64,2 })) with eltype Tuple{Int64,Complex{Int64}}:
249
+ 3×3 StructArray(::Matrix {Int64}, StructArray(::Matrix {Int64}, ::Matrix {Int64})) with eltype Tuple{Int64,Complex{Int64}}:
250
250
(1, 1+2im) (1, 1+3im) (1, 1+4im)
251
251
(1, 2+2im) (1, 2+3im) (1, 2+4im)
252
252
(1, 3+2im) (1, 3+3im) (1, 3+4im)
0 commit comments