[SciPy-user] Easy way to make a block diagonal matrix?

Joshua Stults joshua.stults@gmail....
Wed May 20 16:58:52 CDT 2009


Probably numpy.kron() already provides this functionality plus easily
generating more general block matrices:

http://docs.scipy.org/doc/numpy/reference/generated/numpy.kron.html


On Wed, May 20, 2009 at 5:40 PM, Joseph Smidt <josephsmidt@gmail.com> wrote:
> Actually,  I don't know if you could submit this routine for inclusion
> into scipy itself.  I'm sure there are lots of people who need to
> create block diagonal arrays like this.  Plus, your script looks
> really well written.
>
>                           Joseph Smidt
>
> On Wed, May 20, 2009 at 2:37 PM, Joseph Smidt <josephsmidt@gmail.com> wrote:
>> Thank you, this looks exactly what I need.
>>
>>                      Joseph Smidt
>>
>> 2009/5/20 Stéfan van der Walt <stefan@sun.ac.za>:
>>> Hi Joseph
>>>
>>> 2009/5/20 Joseph Smidt <josephsmidt@gmail.com>:
>>>>     Is there an easy way to create a block diagonal matrix from
>>>> existing matrices?  For example, lets assume I have three 2x2 matrices
>>>> a, b and c.  Is there something like d = block_diag(a,b,c) which would
>>>> create a 6x6 block diagonal matrix from a, b and c?  If not, is there
>>>> a straight forward way to accomplish the same thing?
>>>
>>> The attached function should do the trick.
>>>
>>> Regards
>>> Stéfan
>>>
>>> _______________________________________________
>>> SciPy-user mailing list
>>> SciPy-user@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>>
>>>
>>
>>
>>
>> --
>> ------------------------------------------------------------------------
>> Joseph Smidt <josephsmidt@gmail.com>
>>
>> Physics and Astronomy
>> 4129 Frederick Reines Hall
>> Irvine, CA 92697-4575
>> Office: 949-824-3269
>>
>
>
>
> --
> ------------------------------------------------------------------------
> Joseph Smidt <josephsmidt@gmail.com>
>
> Physics and Astronomy
> 4129 Frederick Reines Hall
> Irvine, CA 92697-4575
> Office: 949-824-3269
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



-- 
Joshua Stults
Website: http://j-stults.blogspot.com


More information about the SciPy-user mailing list