[SciPy-user] Easy way to make a block diagonal matrix?
Joshua Stults
joshua.stults at gmail.com
Wed May 20 18:47:07 EDT 2009
Well that's a good point; I didn't even notice he wanted three
different matrices, I just latched on to 'block diagonal'; I guess
I've only ever used kron type functions for doing block matrices with
the same matrix at each block entry:
http://j-stults.blogspot.com/2009/01/kronecker-product-of-sparse-matrices.html
Like you'd get with a multi-dimensional finite difference
discretization. Just curious, what sort of application would give you
different matrix blocks on the diagonal?
2009/5/20 Stéfan van der Walt <stefan at sun.ac.za>:
> 2009/5/20 Joshua Stults <joshua.stults at gmail.com>:
>> 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
>
> numpy.kron takes two arrays as input, so I'm not sure how that could
> work, especially for diagonal blocks with varying shapes? Would you
> use object arrays? Could be that my brain has gone to bed already!
>
> Regards
> Stéfan
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at 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