[Numpy-discussion] build numpy matrix out of smaller matrix

eat e.antero.tammi at gmail.com
Thu Dec 1 12:28:40 EST 2011


Hi,

On Thu, Dec 1, 2011 at 6:52 PM, jonasr <jonas.ruebsam at web.de> wrote:

>
> Hi,
> is there any possibility to define a numpy matrix, via a smaller given
> matrix, i.e. in matlab
> i can do this like
>
> a=[1 2 ; 3 4 ]
>
>
> A=[a a ; a a ]
>
> so that i finally get
>
> A=[ [1,2,1,2]
>      [3,4,3,4]
>      [1,2,1,2]
>      [3,4,3,4]]
>
> i tried different things on numpy which didn't work
> any ideas ?
>
Perhaps something like this:
In []: a= np.array([[1, 2], [3, 4]])
In []: np.c_[[a, a], [a, a]]
Out[]:
array([[[1, 2, 1, 2],
        [3, 4, 3, 4]],
       [[1, 2, 1, 2],
        [3, 4, 3, 4]]])

Regards,
eat

>
> thank you
>
>
> --
> View this message in context:
> http://old.nabble.com/build-numpy-matrix-out-of-smaller-matrix-tp32896004p32896004.html
> Sent from the Numpy-discussion mailing list archive at Nabble.com.
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20111201/712297f8/attachment.html>


More information about the NumPy-Discussion mailing list