[SciPy-user] Easy way to make a block diagonal matrix?
Wed May 20 20:32:34 CDT 2009
On Wed, May 20, 2009 at 7:23 PM, <firstname.lastname@example.org> wrote:
> 2009/5/20 Stéfan van der Walt <email@example.com>:
>> 2009/5/21 <firstname.lastname@example.org>:
>>> scipy.linalg has some matrix creation functions, some look like
>> Thanks, that looks like a good spot.
>> Please review the attached patch (if anybody does not want it to go
>> in, now is a good time to voice your concerns).
> It might be better to preserve the dtype of the input arrays, e.g. I
> could think of a use for integer variables, e.g. dummy variables in
> regression or anova, or to allow an option for the dtype when you
> create the zeros array.
> I don't know if anybody would want complex or character matrices.
> I just checked, np.kron and np.diag preserves integer type, and
> np.kron converts to float for mixed types, diag preserves character
> otherwise it looks good and useful to me.
> SciPy-user mailing list
What is the definition that you are using for a block diagonal matrix?
Some definitions use square matrices:
But Matlab's blkdiag function does not and, thus, it may not result in
a diagonal matrix:
So the documentation should reflect the selected definition.
Also, I support Josef's suggestion that this function would be
better suited in numpy rather than scipy.
More information about the SciPy-user