# Wrong matrix indicies for mesh generated by Sphere

**URL:** <https://community.freefem.org/t/wrong-matrix-indicies-for-mesh-generated-by-sphere/2564>\
**Category:** General Discussion\
**Created:** [June 27, 2023, 9:47am UTC](https://community.freefem.org/t/wrong-matrix-indicies-for-mesh-generated-by-sphere/2564 "2023-06-27T09:47:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhg](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mhg](https://community.freefem.org/u/mhg)\
**Post date:** [June 27, 2023, 9:47am UTC](https://community.freefem.org/t/wrong-matrix-indicies-for-mesh-generated-by-sphere/2564/1 "2023-06-27T09:47:05Z")

</div>

Hello.

When I set up a matrix for a surface mesh generated by Sphere with different ansatz and test spaces (e.g. P0 and P1) and then extract the matrix entries, the indices are wrong. See the example in  
[testIJC.edp](https://community.freefem.org/uploads/short-url/vxoYwP09OWrxt23MHHb1UN0mR5t.edp) (912 Bytes)  
to reproduce the situation. In particular, the indices in I range from 0 to the size of the martix K (instead of K.n-1).

Is this a bug, or do I something wrong here?
