PyNum, A multidimensional array where the elements are arrays?

J

Jack Liddle

Hi there

I'm using Numerical Python to handle my arrays but I'm not sure how to
accomplish the following.

I want a NxNxNxN array where each element of the the array
(A[i,j,k,l]) is itself a 3x3 array. So I can then slice my array
A[:,:,i,j] into planes and start grabbing matrices from it. I need to
slice it in all possible planes and I don't want to start messing
around with nested lists.

How would I go about doing this in python, I guess in C I would have a
an NxNxNxN array full of pointers to matrix objects, but lifes to
short for C.

Thanks for any help you can give

Jack Liddle
Department Of Theoretical Physics
University Of Oxford
 
D

Duncan Smith

Jack Liddle said:
Hi there

I'm using Numerical Python to handle my arrays but I'm not sure how to
accomplish the following.

I want a NxNxNxN array where each element of the the array
(A[i,j,k,l]) is itself a 3x3 array. So I can then slice my array
A[:,:,i,j] into planes and start grabbing matrices from it. I need to
slice it in all possible planes and I don't want to start messing
around with nested lists.

How would I go about doing this in python, I guess in C I would have a
an NxNxNxN array full of pointers to matrix objects, but lifes to
short for C.

Will an NxNxNxNx3x3 array not do the job? Alternatively you can have an
NxNxNxN array of type PyObject (less efficient I would think).

Duncan
 
A

Andrew McLean

Jack Liddle said:
I'm using Numerical Python to handle my arrays but I'm not sure how to
accomplish the following.

I want a NxNxNxN array where each element of the the array
(A[i,j,k,l]) is itself a 3x3 array. So I can then slice my array
A[:,:,i,j] into planes and start grabbing matrices from it. I need to
slice it in all possible planes and I don't want to start messing
around with nested lists.

How would I go about doing this in python, I guess in C I would have a
an NxNxNxN array full of pointers to matrix objects, but lifes to
short for C.

Is there any reason not to just use an NxNxNxNx3x3 array?

If you do this then the 3x3 matrices look like A[i,j,k,l,:,:]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,175
Messages
2,570,942
Members
47,476
Latest member
blackwatermelon

Latest Threads

Top