[SciPy-user] Kronecker product kron(a,b)

Nils Wagner nwagner at mecha.uni-stuttgart.de
Wed Sep 24 11:52:28 EDT 2003


Dear experts,

There is another useful function which might be interesting for scipy,
the so-called Kronecker product of two matrices.

def kron(a,b):
    if not a.iscontiguous():
        a = reshape(a, a.shape)
    if not b.iscontiguous():
        b = reshape(b, b.shape)
    o = outerproduct(a,b)
    o.shape = a.shape + b.shape
    return concatenate(concatenate(o, axis=1), axis=1)

It would be great, if this becomes a standard function in scipy.

Any comments ?

Nils




More information about the SciPy-User mailing list