0
$\begingroup$

I want to create a matrix where each entry itself is a random matrix. What would be a good way to represent this?

It is not necessary but some hints on how to implement your proposed solution in Python would be useful.

$\endgroup$

closed as off-topic by D.W. Feb 25 '16 at 12:03

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about software development or programming tools are off-topic here, but can be asked on Stack Overflow." – D.W.
If this question can be reworded to fit the rules in the help center, please edit the question.

1
$\begingroup$

What you are looking for is just a higher dimensional array.

Let's say you want a 5x5 array where each element is a 2x2 array with random number. You can easily represent that as a 5x5x2x2 array.

If you are happy about using numpy

A = numpy.random.rand(5,5,2,2)

Will create a 5x5x2x2 array.

You can use the first two indexes to access your 2D random arrays.

print A[1,1]

Results in:

[[ 0.68527006  0.37304491]
 [ 0.23281899  0.46951261]]
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.