Julia - using dictionary key as index for a multidimensional array -


i have dictionary keys shown:

testdict = dict{array{int64,1},float64}([1,3,1] => 0.0, [2,3,1] => 0.0, [1,3,2] => 0.0, [2,3,2] => -2.64899e-16, [2,1,2] => 0.858307, [1,2,1] => 0.0, [1,2,2] => 0.0, [2,2,1] => 0.0, [2,2,2] => 0.65796, [2,1,1] => -5.81556e-16, [1,1,2] => -3.50541e-16, [1,1,1] => 0.0) 

these keys vary considerably both regarding range , length, initialized array in beginning of function im writing...it

[2,3,2] 

for dictionary above...,

or

[10,3,50,60] 

creating dictionary keys

[1,1,1,1], [1,1,1,12] ... , [10, 3, 50, 59], [10,3, 50, 60] 

and need accomplish, create multidimensional array

result_array = array(float64, tuple([2,3,2]) 

but need populate array values dictionary, need set element [1,1,1]

result_array[1,1,1] = 0.0 

how can use keys dictionary set indices of result_array respected values?

splat key turn result_array[[1,1,1]...] result_array[1,1,1].

testdict = dict{array{int64,1},float64}([1,3,1] => 0.0, [2,3,1] => 0.0, [1,3,2] => 0.0, [2,3,2] => -2.64899e-16, [2,1,2] => 0.858307, [1,2,1] => 0.0, [1,2,2] => 0.0, [2,2,1] => 0.0, [2,2,2] => 0.65796, [2,1,1] => -5.81556e-16, [1,1,2] => -3.50541e-16, [1,1,1] => 0.0)  result_array = array(float64,2,3,2)  (k,v) in testdict   result_array[k...] = testdict[k] end 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -