[SciPy-user] Stack two matrices on top of each other?

lorenzo bolla lbolla@gmail....
Wed Sep 26 07:58:55 CDT 2007


In [5]: a.shape
Out[5]: (2, 3)

In [6]: numpy.bmat([a,a]).shape
Out[6]: (2, 6)

In [7]: numpy.bmat([[a],[a]]).shape
Out[7]: (4, 3)

L.


On 9/26/07, Jose Unpingco <unpingco@osc.edu> wrote:
>
>
>  a=randn(2,3)
>  bmat([[a],[a]]) # stack them side-by-side
>
> But, this doesn't work with the semicolon:
>
>  bmat([[a];[a]]) # not work, although it would be natural
>
> Is there another way to stack two matrices on top of each other? I know I
> can do
>
> bmat('a ; a')
>
> but I have a list of matrices I would like to stack and doing it this way
> means that I would have to
> assign a variable to each one of matrices like
>
> a0=A[0]
> a1=A[1]
> ..
> aN=A[N]
>
> which is what I'm doing now, but would prefer not to.
>
>
>
> Please contact me if you have questions or need more information.
>
>  Thanks!
>
> Jose Unpingco, Ph.D.
> (619)553-2922
>
>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20070926/afc08342/attachment.html 


More information about the SciPy-user mailing list