# Matrix/Array multiplication

**URL:** <https://community.freefem.org/t/matrix-array-multiplication/3394>\
**Category:** General Discussion\
**Created:** [July 12, 2024, 1:54pm UTC](https://community.freefem.org/t/matrix-array-multiplication/3394 "2024-07-12T13:54:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![HMasson](https://avatars.discourse-cdn.com/v4/letter/h/b9bd4f/32.png) [@HMasson](https://community.freefem.org/u/HMasson)\
**Post date:** [July 12, 2024, 1:54pm UTC](https://community.freefem.org/t/matrix-array-multiplication/3394/1 "2024-07-12T13:54:29Z")

</div>

Hello,

I am using a Gaussian quadrature method for computing statistical moments.  
I am running into a surprising issue, the following bit of code does not work :

```auto
real[int] A = [1, 2, 3];
real[int] B = [4, 5, 6];
real[int, int] C = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
real D = A'*C*B;

```

While this one does :

```auto
real[int] A = [1, 2, 3];
real[int] B = [4, 5, 6];
real[int, int] C = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
real[int] E = C*B;
real D = A'*E;

```

What is the issue with the first bit of code, and what has significantly changed in the second code that makes it work ?  
Thank you in advance,  
Hugo

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [July 12, 2024, 3:29pm UTC](https://community.freefem.org/t/matrix-array-multiplication/3394/2 "2024-07-12T15:29:27Z")

</div>

FreeFEM does not know how to compute a series of operations grouped a single statement, as done in your first code snippet, so you need to break them down into multiple statements, as done in your second code snippet.
