# Iterate through tensor in paraview programable filter

**URL:** https://discourse.paraview.org/t/iterate-through-tensor-in-paraview-programable-filter/12290
**Category:** ParaView Support
**Created:** [June 12, 2023, 12:43pm UTC](https://discourse.paraview.org/t/iterate-through-tensor-in-paraview-programable-filter/12290 "2023-06-12T12:43:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Trailer1](https://discourse.paraview.org/user_avatar/discourse.paraview.org/trailer1/32/5143_2.png) [@Trailer1](https://discourse.paraview.org/u/Trailer1)
#### Post date: [June 12, 2023, 12:43pm UTC](https://discourse.paraview.org/t/iterate-through-tensor-in-paraview-programable-filter/12290/1 "2023-06-12T12:43:47Z")

</div>

Hello,

I would like to iterate over a tensor in paraview to compute its eigenvalues and eigenvectors. But currently I am unable to do so.

I have:

```auto
import numpy as np

input0 = inputs[0]
data = input0.CellData["tau"]

nCells = input0.GetNumberOfCells()
eigenVals = np.zeros((nCells, 3))
eigVecs= np.zeros((nCells, 3, 3))

for i in range(nCells):
  T = # How can I get the numpy array representing the data? 
 eigenVals[i], eigVecs[i] =np.linalg.eig(T)
    

output.CellData.append(eigVals,"eigenValues")
output.CellData.append(eigVecs,"eigenVectors")

```

How can I fix this?

---

<div class="post-metadata">

### Author: ![Trailer1](https://discourse.paraview.org/user_avatar/discourse.paraview.org/trailer1/32/5143_2.png) [@Trailer1](https://discourse.paraview.org/u/Trailer1)
#### Post date: [June 14, 2023, 4:38pm UTC](https://discourse.paraview.org/t/iterate-through-tensor-in-paraview-programable-filter/12290/2 "2023-06-14T16:38:36Z")

</div>

Anyone that can help with how to iterate over a field in paraview?

---

<div class="post-metadata">

### Author: ![Sanjay\_GOVINDJEE](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sanjay_govindjee/32/11746_2.png) [@Sanjay\_GOVINDJEE](https://discourse.paraview.org/u/Sanjay_GOVINDJEE)
#### Post date: [June 17, 2023, 1:03pm UTC](https://discourse.paraview.org/t/iterate-through-tensor-in-paraview-programable-filter/12290/3 "2023-06-17T13:03:21Z")

</div>

How about  
`T = np.array( data[i,:,:] )`
