Are you using 0.3 or 0.4? You could try making `SpatialData` a subtype of
`AbstractArray`. It's possible to do on either version, but it's
substantially easier to do on 0.4. Then you could use any of the methods
in base that are defined for `AbstractArray` (including `maximum`)
directly. If you're on 0.4, you could crib off of a type I created to test
the indexing
behaviors:
https://github.com/JuliaLang/julia/blob/master/test/abstractarray.jl#L30-L69
On Tuesday, July 7, 2015 at 12:05:15 PM UTC-4, Júlio Hoffimann wrote:
>
> What I'm actually trying to do is create a type for spatial data:
>
> typealias SpatialData Dict{Tuple{Integer,Integer,Integer},Real}
>
> data = SpatialData([(i,j,k) => rand() for i=1:10, j=1:20, k=1:30])
>
> However I need to do some checks on the size of the bounding box,
> (10,20,30) in this case.
>
> What I'm doing right now is loop over keys(data), but I would like to make
> it a matrix and simply apply the builtin maximum() to the columns. Does
> anyone suggest a better design? How to create such a type to support these
> checks?
>
> I also tried to play with sparse matrices, but I need 3D spatial data
> representation.
>
> -Júlio
>