# Operator overload \* Hadamard-Schur (Element-wise) or Dot Product

**URL:** <https://forum.compas-framework.org/t/operator-overload-hadamard-schur-element-wise-or-dot-product/578>\
**Category:** Uncategorized\
**Created:** [March 24, 2022, 10:21am UTC](https://forum.compas-framework.org/t/operator-overload-hadamard-schur-element-wise-or-dot-product/578 "2022-03-24T10:21:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pirouz](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@Pirouz](https://forum.compas-framework.org/u/Pirouz)\
**Post date:** [March 24, 2022, 10:21am UTC](https://forum.compas-framework.org/t/operator-overload-hadamard-schur-element-wise-or-dot-product/578/1 "2022-03-24T10:21:51Z")

</div>

Hi, I was wondering if the operator \* has been overridden for transformation matrices in COMPAS. I came across [this example](https://compas.dev/compas/1.6.3/api/generated/compas.geometry.Rotation.html#compas.geometry.Rotation) in transformations where the three transformation matrices Rx, Ry, and Rz seem to have been multiplied together to make a compound transformation. As in Numpy \* would perform the Hadamard-Schur (element-wise) product, I am wondering if the operator \* has been overridden to act as matrix product in compas?

---

<div class="post-metadata">

**Author:** ![tomvanmele](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/tomvanmele/32/13_2.png) [@tomvanmele](https://forum.compas-framework.org/u/tomvanmele)\
**Post date:** [March 29, 2022, 12:14pm UTC](https://forum.compas-framework.org/t/operator-overload-hadamard-schur-element-wise-or-dot-product/578/2 "2022-03-29T12:14:17Z")

</div>

hi pirouz,

yes indeed `*` has been implemented as a matrix product for the transformation matrices.

perhaps `@` would probably have been more appropriate. that said though, also in `numpy` `*` is used for matrix products when dealing with actual matrices ([numpy.matrix — NumPy v1.21 Manual](https://numpy.org/doc/1.21/reference/generated/numpy.matrix.html)) instead of arrays, which i believe was done this way because of similarity with Matlab syntax.

---

<div class="post-metadata">

**Author:** ![Pirouz](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@Pirouz](https://forum.compas-framework.org/u/Pirouz)\
**Post date:** [April 9, 2022, 10:23pm UTC](https://forum.compas-framework.org/t/operator-overload-hadamard-schur-element-wise-or-dot-product/578/3 "2022-04-09T22:23:33Z")

</div>

Hi Tom, thanks for the superb answer; yet another wonder about numpy 😺

---

<div class="post-metadata">

**Author:** ![gonzalocasas](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/gonzalocasas/32/127_2.png) [@gonzalocasas](https://forum.compas-framework.org/u/gonzalocasas)\
**Post date:** [April 11, 2022, 11:57pm UTC](https://forum.compas-framework.org/t/operator-overload-hadamard-schur-element-wise-or-dot-product/578/4 "2022-04-11T23:57:43Z")

</div>

> [@tomvanmele](#):
>
> perhaps `@` would probably have been more appropriate

iirc, `@` is not compatible with py2.7, so it breaks the parser in rhino. not sure if this was the reason, but it is at least another reason in favor of the `*`.
