@@ -87,33 +87,33 @@ a[1] *= 2
8787a = [SVector (0.0 ) for _ in 1 : 2 ]
8888a_voa = VectorOfArray (a)
8989b_voa = copy (a_voa)
90- a_voa[1 ] = SVector (1.0 )
91- a_voa[2 ] = SVector (1.0 )
90+ a_voa[:, 1 ] = SVector (1.0 )
91+ a_voa[:, 2 ] = SVector (1.0 )
9292@. b_voa = a_voa
93- @test b_voa[1 ] == a_voa[1 ]
94- @test b_voa[2 ] == a_voa[2 ]
93+ @test b_voa[:, 1 ] == a_voa[1 ]
94+ @test b_voa[:, 2 ] == a_voa[2 ]
9595
9696a = [SVector (0.0 ) for _ in 1 : 2 ]
9797a_voa = VectorOfArray (a)
9898a_voa .= 1.0
99- @test a_voa[1 ] == SVector (1.0 )
100- @test a_voa[2 ] == SVector (1.0 )
99+ @test a_voa[:, 1 ] == SVector (1.0 )
100+ @test a_voa[:, 2 ] == SVector (1.0 )
101101
102102# Broadcasting when SVector{N} where N > 1
103103a = [SVector (0.0 , 0.0 ) for _ in 1 : 2 ]
104104a_voa = VectorOfArray (a)
105105b_voa = copy (a_voa)
106- a_voa[1 ] = SVector (1.0 , 1.0 )
107- a_voa[2 ] = SVector (1.0 , 1.0 )
106+ a_voa[:, 1 ] = SVector (1.0 , 1.0 )
107+ a_voa[:, 2 ] = SVector (1.0 , 1.0 )
108108@. b_voa = a_voa
109- @test b_voa[1 ] == a_voa[1 ]
110- @test b_voa[2 ] == a_voa[2 ]
109+ @test b_voa[:, 1 ] == a_voa[:, 1 ]
110+ @test b_voa[:, 2 ] == a_voa[:, 2 ]
111111
112112a = [SVector (0.0 , 0.0 ) for _ in 1 : 2 ]
113113a_voa = VectorOfArray (a)
114114a_voa .= 1.0
115- @test a_voa[1 ] == SVector (1.0 , 1.0 )
116- @test a_voa[2 ] == SVector (1.0 , 1.0 )
115+ @test a_voa[:, 1 ] == SVector (1.0 , 1.0 )
116+ @test a_voa[:, 2 ] == SVector (1.0 , 1.0 )
117117
118118# Broadcast Copy of StructArray
119119x = StructArray {SVector{2, Float64}} ((randn (2 ), randn (2 )))
@@ -122,12 +122,12 @@ vx2 = copy(vx) .+ 1
122122ans = vx .+ vx2
123123@test ans. u isa StructArray
124124
125- # check that Base.similar(VectorOfArray{<:StaticArray}) returns the
125+ # check that Base.similar(VectorOfArray{<:StaticArray}) returns the
126126# same type as the original VectorOfArray
127127x_staticvector = [SVector (0.0 , 0.0 ) for _ in 1 : 2 ]
128128x_structarray = StructArray {SVector{2, Float64}} ((randn (2 ), randn (2 )))
129129x_mutablefv = [MutableFV (1.0 , 2.0 )]
130130x_immutablefv = [ImmutableFV (1.0 , 2.0 )]
131131for vec in [x_staticvector, x_structarray, x_mutablefv, x_immutablefv]
132132 @test typeof (similar (VectorOfArray (vec))) === typeof (VectorOfArray (vec))
133- end
133+ end
0 commit comments