Python | Numpy np.kron () method



With the np.kron() method we can get the Kronecker product from two lists using np.kron () .

Syntax: np.kron (list1, list2)

Return : Return the kronecker product of two list.

Example # 1:
In this example, we see that using np.kron () we can get the kronecker product of two arrays passed as an argument.

# NumPy import

import numpy as np

 
# using the np.kron () method

gfg = np.kron ([ 1 , 2 , 3 ], [ 5 , 10 , 15 ])

 

print (gfg)

Exit:

[5 10 15 10 20 30 15 30 45]

Example # 2:

# NumPy import

import numpy as np

 
# using the np.kron () method

gfg  = np.kron ([[ 1 , 2 , 3 ], [ 9 , 8 , 7 ]], [ 5 , 10 , 15 ])

 

print (gfg)

Output:

[[5 10 15 10 20 30 15 30 45]
[ 45 90 135 40 80 120 35 70 105]]