[Numpy-discussion] how to create a block diagonal matrix by repeating the block?

Jose Borreguero borreguero@gmail....
Fri Aug 12 06:53:29 CDT 2011


Thanks!
Jose



On Thu, Aug 11, 2011 at 8:15 PM, Fernando Perez <fperez.net@gmail.com>wrote:

> On Thu, Aug 11, 2011 at 4:43 PM, Jose Borreguero <borreguero@gmail.com>
> wrote:
> > a = random.randn(3,3)
> > b = a.reshape(1,3,3).repeat(50,axis=0)
> > scipy.linalg.block_diag( *b )
> >
>
> slightly simpler, but equivalent, code:
>
> b = [a]*50
> scipy.linalg.block_diag( *b)
>
> Cheers,
>
> f
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110812/1f2a1cd0/attachment.html 


More information about the NumPy-Discussion mailing list