[SciPy-user] Easy way to make a block diagonal matrix?
mike dewar
mikedewar at gmail.com
Wed May 20 19:06:18 EDT 2009
A state space model consisting of three independent dynamic
structures, but sharing a common input would use a block diagonal
structure in the state matrix. So if
x_t = Ax_{t-1} + Bu_{t-1}
where x_t is the state at time t, u_t is the input at time t, and
where B was a full matrix but A was block diagonal, s.t.
A = [A_1 0 0
0 A_2 0
0 0 A_3]
could describe three independent dynamic systems acted on by the same
input. We use block matrices a lot when the state of a system consists
of something like a Takens embedding, where the model state consists
of the current and past systems states, so as to make everything
Markovian and therefore easier to deal with. The state matrix is then
naturally 'blocky' and sometimes it's quicker to refer to blocks
rather than constantly messing about with slicing.
Cheers,
Mike Dewar
On 20 May 2009, at 23:47, Joshua Stults wrote:
> 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
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
More information about the SciPy-User
mailing list