Re: Putting together a larger matrix from smaller matrices

2009-08-25 Thread Peter Otten
Matjaz Bezovnik wrote: This is something which is done often in FEM methods, and the alike. I have matrix A of 3x3 elements, and B, of the same number of elements, 3x3. What would be the most obvious way to assemble a matrix which: a11 a12 a13 a21 a22 a23 a31 a32 a33+b11 b12 b13

Re: Putting together a larger matrix from smaller matrices

2009-08-25 Thread Scott David Daniels
Matjaz Bezovnik wrote: If you are using numpy (which it sounds like you are): IDLE 2.6.2 import numpy as np v = np.array([[0,1,2],[3,4,5],[6,7,8]], dtype=float) v array([[ 0., 1., 2.], [ 3., 4., 5.], [ 6., 7., 8.]]) w = np.array([[10,11,12],[13,14,15],[16,17,18]],

Re: Putting together a larger matrix from smaller matrices

2009-08-25 Thread Matjaz Bezovnik
On Tue, 25 Aug 2009 08:26:44 -0700, Scott David Daniels scott.dani...@acm.org wrote: Matjaz Bezovnik wrote: If you are using numpy (which it sounds like you are): IDLE 2.6.2 import numpy as np v = np.array([[0,1,2],[3,4,5],[6,7,8]], dtype=float) v array([[ 0., 1., 2.], [ 3.,

Re: Putting together a larger matrix from smaller matrices

2009-08-25 Thread sturlamolden
On 25 Aug, 17:37, Matjaz Bezovnik mbezov...@freenet.si wrote: Scott, thank you very much for the snippet. It is exactly what I looked for; simple to read and obvious as to what it does even a month later to a non-pythonist! Since you were talking about matrices, observe that numpy has a

Re: Putting together a larger matrix from smaller matrices

2009-08-25 Thread Robert Kern
On 2009-08-24 21:30 PM, Matjaz Bezovnik wrote: Dear all, I'm but a layman so do not take offence at this maybe over simple question. This is something which is done often in FEM methods, and the alike. I have matrix A of 3x3 elements, and B, of the same number of elements, 3x3. What would be

Putting together a larger matrix from smaller matrices

2009-08-24 Thread Matjaz Bezovnik
Dear all, I'm but a layman so do not take offence at this maybe over simple question. This is something which is done often in FEM methods, and the alike. I have matrix A of 3x3 elements, and B, of the same number of elements, 3x3. What would be the most obvious way to assemble a matrix