JuliaArrays / MappedArrays.jl
Showing 2 of 3 files from the diff.
Newly tracked file
src/ProductedArrays.jl created.
Other files ignored by Codecov
Project.toml has changed.

@@ -0,0 +1,24 @@
Loading
1 +
module ProductedArrays
2 +
    export ProductedArray
3 +
4 +
    struct ProductedArray{T, N, AAs<:Tuple{Vararg{AbstractArray}}} <: AbstractArray{T, N}
5 +
        data::AAs
6 +
    end
7 +
    function ProductedArray(data...)
8 +
        ProductedArray{typeof(map(first, data)), mapreduce(ndims, +, data), typeof(data)}(data)
9 +
    end
10 +
11 +
    @inline Base.size(A::ProductedArray) = mapreduce(size, (i,j)->(i...,j...), A.data)
12 +
13 +
    Base.@propagate_inbounds function Base.getindex(A::ProductedArray{T, N}, inds::Vararg{Int, N}) where {T, N}
14 +
        map((x, i)->x[i...], A.data, _split_indices(A, inds))
15 +
    end
16 +
17 +
    # TODO: this fails to inline and thus gives about 1.5ns overhead to getindex
18 +
    @inline function _split_indices(A::ProductedArray{T, N}, inds::NTuple{N, Int}) where {T, N}
19 +
        # TODO: this line is repeatedly computed
20 +
        pos = (firstindex(A.data)-1, accumulate(+, map(ndims, A.data))...)
21 +
22 +
        return ntuple(i->inds[pos[i]+1:pos[i+1]], length(pos)-1)
23 +
    end
24 +
end

@@ -4,6 +4,10 @@
Loading
4 4
5 5
export AbstractMappedArray, MappedArray, ReadonlyMappedArray, mappedarray, of_eltype
6 6
7 +
using Reexport
8 +
include("ProductedArrays.jl")
9 +
@reexport using .ProductedArrays
10 +
7 11
abstract type AbstractMappedArray{T,N} <: AbstractArray{T,N} end
8 12
abstract type AbstractMultiMappedArray{T,N} <: AbstractMappedArray{T,N} end
9 13
Files Coverage
src 78.03%
Project Totals (2 files) 78.03%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading