For simple cases there's also the IndirectArrays package:
https://github.com/JuliaArrays/IndirectArrays.jl

Best,
--Tim

On Fri, Sep 30, 2016 at 10:51 PM, <[email protected]> wrote:

> OK!  many thanks for your fast reply
> --a
>
>
> On Friday, September 30, 2016 at 3:53:43 PM UTC+2, [email protected]
> wrote:
>>
>> Hi guys,
>>
>> I'm learning the language while implementing an advanced package for
>> geometric and solid modeling.
>> My question is: What is the right idiom (shorter and/or faster) for
>> writing this kind of array indexing:
>>
>> linesFromLineArray(V,EV) = Any[[V[:,EV[:,k][1]] V[:,EV[:,k][2]]  ] for
>> k=1:size(EV,2)]
>>
>> The efficiency is the strongest issue, since this method should provide
>> the indirect indexing for any kind of cellular complexes.
>> Many thanks for your help
>>
>>
>> julia> V,EV
>> (
>> 2x10 Array{Float64,2}:
>>  0.13611  0.14143  0.38501  0.42103  0.96927  0.90207  0.0     0.11508
>>  0.61437  0.52335
>>  0.59824  0.58921  0.25964  0.24118  0.19741  0.34109  0.0213  0.0
>>  0.05601  0.17309,
>>
>> 2x5 Array{Int64,2}:
>>  1  3  5  7   9
>>  2  4  6  8  10)
>>
>> julia> linesFromLineArray(V,EV)
>> 5-element Array{Any,1}:
>>  2x2 Array{Float64,2}:
>>  0.13611  0.14143
>>  0.59824  0.58921
>>  2x2 Array{Float64,2}:
>>  0.38501  0.42103
>>  0.25964  0.24118
>>  2x2 Array{Float64,2}:
>>  0.96927  0.90207
>>  0.19741  0.34109
>>  2x2 Array{Float64,2}:
>>  0.0     0.11508
>>  0.0213  0.0
>>  2x2 Array{Float64,2}:
>>  0.61437  0.52335
>>  0.05601  0.17309
>>
>>

Reply via email to