# External product of StaticArrays vectors

**URL:** <https://discourse.julialang.org/t/external-product-of-staticarrays-vectors/56955>\
**Category:** Performance\
**Tags:** staticarrays\
**Created:** [March 11, 2021, 3:20pm UTC](https://discourse.julialang.org/t/external-product-of-staticarrays-vectors/56955 "2021-03-11T15:20:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philippe\_Maincon1](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Post date:** [March 11, 2021, 3:20pm UTC](https://discourse.julialang.org/t/external-product-of-staticarrays-vectors/56955/1 "2021-03-11T15:20:32Z")

</div>

Hi,

I have two SVector’s, and I wish to compute their external product. I have three requirements

1. the output should be a SMatrix,
2. the operation should be FAST (slow, I can do myself…)
3. preferably, the output is non-mutable

The later requirement makes it difficult for me to create a naive implementation…

Is the operation implemented? I could not find it in the StaticArrays docs.

🙂

Philippe

---

<div class="post-metadata">

**Author:** ![mateuszbaran](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mateuszbaran/32/221842_2.png) [@mateuszbaran](https://discourse.julialang.org/u/mateuszbaran)\
**Post date:** [March 11, 2021, 3:31pm UTC](https://discourse.julialang.org/t/external-product-of-staticarrays-vectors/56955/2 "2021-03-11T15:31:55Z")

</div>

Hi!

Do you mean outer product? If so, you can just do

```julia
julia> a = @SVector randn(4);

julia> b = @SVector randn(4);

julia> a*b'
4×4 SArray{Tuple{4,4},Float64,2,16} with indices SOneTo(4)×SOneTo(4):
  0.423303 0.402792 0.373048 0.136053
 -0.782696 -0.744771 -0.689774 -0.251565
  0.774667 0.73713 0.682698 0.248984
 -0.982405 -0.934802 -0.865773 -0.315753

```

---

<div class="post-metadata">

**Author:** ![Philippe\_Maincon1](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Post date:** [March 11, 2021, 3:38pm UTC](https://discourse.julialang.org/t/external-product-of-staticarrays-vectors/56955/3 "2021-03-11T15:38:39Z")

</div>

Yes, outer, not external  
Oh so simple!!! 🤣

Thanks!
