Reputation: 2019
Doesn't Apple simd module have a standard function for outer product of two vectors? I see it only has dot_product
and cross_product
for vectors.
Using matrix representation of vectors for implementing outer product via matrix multiplication doesn't seem possible also since Apple simd doesn't support 1-dimensional matricies afaik.
So the only way is to implement outer product themself? Not that it's hard, I just find it amusing that specialized vector library doesn't have outer product as a standard function.
I use this implementation for now:
func outer_product(_ a: float2, _ b: float2) -> simd_float2x2 {
simd_float2x2(a*b.x, a*b.y)
}
Upvotes: 1
Views: 149