|
13 | 13 | end
|
14 | 14 | end
|
15 | 15 |
|
16 |
| -# Tuple indexing into AbstractArray. TODO, move into base |
17 |
| -@generated function getindex{S}(a::AbstractArray, inds::NTuple{S,Integer}) |
18 |
| - exprs = [:(a[inds[$i]]) for i = 1:S] |
19 |
| - return quote |
20 |
| - $(Expr(:meta, :inline, :propagate_inbounds)) |
21 |
| - return $(Expr(:tuple, exprs...)) |
22 |
| - end |
23 |
| -end |
24 |
| -# Convert to StaticArrays using tuples |
25 |
| -# TODO think about bounds checks here. |
26 |
| -@generated function getindex{S,T}(m::AbstractArray{T}, inds1::NTuple{S, Integer}, i2::Integer) |
27 |
| - exprs = [:(m[inds1[$j], i2]) for j = 1:S] |
28 |
| - return Expr(:tuple, exprs...) |
29 |
| -end |
30 |
| - |
31 |
| -@generated function getindex{S,T}(m::AbstractArray{T}, i1::Integer, inds2::NTuple{S, Integer}) |
32 |
| - exprs = [:(m[i1, inds2[$j]]) for j = 1:S] |
33 |
| - return Expr(:tuple, exprs...) |
34 |
| -end |
35 |
| - |
36 |
| -@generated function getindex{S1,S2,T}(m::AbstractArray{T}, inds1::NTuple{S1, Integer}, inds2::NTuple{S2, Integer}) |
37 |
| - exprs = [:(m[inds1[$j1], inds2[$j2]]) for j1 = 1:S1, j2 = 1:S2] |
38 |
| - return Expr(:call, SMatrix{S1,S2,T}, Expr(:tuple, exprs...)) # TODO decision: return tuple? Leave it? |
39 |
| -end |
40 |
| - |
41 | 16 | # Static Vector indexing into AbstractArrays
|
42 | 17 | @generated function getindex{T, I <: Integer}(
|
43 | 18 | a::AbstractArray{T}, inds::StaticVector{I}
|
|
0 commit comments