In this code snippet:
using StaticArrays
Vec2f = SVector{2, Float32}
Vec3f = SVector{3, Float32}
a = Vec3f(1, 2, 3)
b = a[1:2]
c = a[[true, false, true]]
b
and c
type is Array{Float32,1}
. How do I make these transformations to get b
and c
of type Vec2f
?
jling
#2
you can try to use @view
to do what you need to do.
or, given what you already have,
Vec2f(a[1:2])
works
1 Like
b = a[StaticArrays.SUnitRange(1, 2)]
Cf
2 Likes