# Invalide array size

**URL:** https://community.freefem.org/t/invalide-array-size/890
**Category:** General Discussion
**Created:** [April 4, 2021, 10:36pm UTC](https://community.freefem.org/t/invalide-array-size/890 "2021-04-04T22:36:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://community.freefem.org/u/Robert)
#### Post date: [April 4, 2021, 10:36pm UTC](https://community.freefem.org/t/invalide-array-size/890/1 "2021-04-04T22:36:52Z")

</div>

Hello again,

I have the following lines:

> ```
> > load "SLEPc-complex"
> > include "macro_ddm.idp"
> > 
> > mesh Th=readmesh("D:\\Test\\Mesh.msh");		
> > plot (Th, cmm="Mesh.msh", wait=true);
> > 
> > func E = [P2, P2, P2, P1];
> > fespace XXXXFES(Th, E);	    
> > XXXXFES<complex>[ue,ve,we,pe]; 
> > XXXXFES<complex>[hx,hy,hz,q];	
> > XXXXFES[Ub,Vb,Wb,Pb];		    
> > 
> > Mat<complex> M;
> > createMat(Th, M, E)
> 
> ```

When I run the program I get the following error:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/1X/b178f38d4f42acbf85efa7c09df6a242e943a336.png)

I also tried to write directly [P2, P2, P2, P1] instead of declaring a function E but it still doesn’t work and I don’t understand why. Writing only one element like createMat(Th, M, P2) works but otherwise I get this error. I also mention that the examples available run with no problem. May it be related somehow to the mesh? It was obtained from a single core simulation.  
Thank you in advance!

---

<div class="post-metadata">

### Author: ![zhaog6](https://avatars.discourse-cdn.com/v4/letter/z/4af34b/32.png) [@zhaog6](https://community.freefem.org/u/zhaog6)
#### Post date: [April 5, 2021, 4:11am UTC](https://community.freefem.org/t/invalide-array-size/890/2 "2021-04-05T04:11:08Z")

</div>

As shown in the error message, the vectorial macros `def` and `init` is missing (scalar macros by default). You can do it in the following way.

```auto
Mat<complex> M;
{
    macro def(u) [u, u#B, u#C, u#D] //
    macro init(u) [u, u, u, u] //
    createMat(Th, M, E);
}

```

Thanks

---

<div class="post-metadata">

### Author: ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://community.freefem.org/u/Robert)
#### Post date: [April 5, 2021, 1:25pm UTC](https://community.freefem.org/t/invalide-array-size/890/3 "2021-04-05T13:25:30Z")

</div>

Thank you, it works now.
