File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -232,3 +232,24 @@ mulX .= sqrt.(abs.(testva .* testvb))
232232a = ArrayPartition (1 : 5 , 1 : 6 )
233233a[1 : 8 ]
234234a[[1 , 3 , 8 ]]
235+
236+ # ###################################################################
237+ # test when VectorOfArray is constructed from a linearly indexed
238+ # multidimensional array of arrays
239+ # ###################################################################
240+
241+ u_matrix = VectorOfArray (fill ([1 , 2 ], 2 , 3 ))
242+ u_vector = VectorOfArray (vec (u_matrix. u))
243+
244+ # test broadcasting
245+ function foo! (u)
246+ @. u += 2 * u * abs (u)
247+ return u
248+ end
249+ foo! (u_matrix)
250+ foo! (u_vector)
251+ @test u_matrix ≈ u_vector
252+
253+ # test efficiency
254+ num_allocs = @allocations foo! (u_matrix)
255+ @test num_allocs == 0
You can’t perform that action at this time.
0 commit comments