I am currently working with numpy.ndarray. I initialize a multi-dimensional matrix :
phi = np.zeros(dim_tuple(dim,L)+(2,))
where dim_tuple(dim,L) return the tuple (L,L, ... ,L) with dim times L.
I would like to create a function taking as arguments:
- an array x of length dim
- a number N: 0 or 1
which will update the value of the element [x[0],x[1], ..., x[dim],N] of the matrix phi.
From now, I tried this:
index = np.append(x,N)
phi[index]=new_value
except that it does not works. In fact, I check that it returns this command:
phi[[x[0],x[1],...,x[dim],N]] = new_value
I tried to find an answer on the internet but I was not successful.
Thank you for your help !
Jérémie