[Numpy-discussion] Kronecker product

Charles G Waldman cgw at alum.mit.edu
Wed Jul 18 10:07:07 CDT 2001

Nils Wagner writes:
 > How can I rearrange the result of outerproduct to the result of
 > Kronecker product with numpy ?

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

More information about the Numpy-discussion mailing list