Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Indexing with Composite Type

$
0
0

Is there a way to easily create a Composite type where all indexing would apply to a ‘Matrix’ field in the type?

For ex:

Mutable Struct Foo
    hist::Int
    matrix::AbstractMatrix
end

bar = Foo(10,rand(10,10))

I would like to be able to bar[1:5,2:6] or any of there other ways to index into, assign bar[bar.>.5] .= 123 , create views, where the indexing/setting would be done on bar.matrix. Of course there would be other methods that rely on the hist field and the matrix field.


Stephen

4 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795

Latest Images

Trending Articles



Latest Images