diff options
author | Ganesh Kathiresan <ganesh3597@gmail.com> | 2022-04-18 20:15:53 +0530 |
---|---|---|
committer | Ganesh Kathiresan <ganesh3597@gmail.com> | 2022-04-18 20:15:53 +0530 |
commit | 8e447c8d64fc88390a5dcc4f205fad40fe470f4e (patch) | |
tree | 10092a6491a57ae93682d298fd4e79ba5cac372d | |
parent | 968ca6caf165ed846b5e9448294a095dcd6c3d15 (diff) | |
download | numpy-8e447c8d64fc88390a5dcc4f205fad40fe470f4e.tar.gz |
MAINT: Added comment for kron working
-rw-r--r-- | numpy/lib/shape_base.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py index d8f1644a2..ab91423d9 100644 --- a/numpy/lib/shape_base.py +++ b/numpy/lib/shape_base.py @@ -1139,6 +1139,15 @@ def kron(a, b): True """ + # Working: + # 1. Equalise the shapes by prepending smaller array with 1s + # 2. Expand shapes of both the arrays by adding new axes at + # odd positions for 1st array and even positions for 2nd + # 3. Compute the product of the modified array + # 4. The inner most array elements now contain the rows of + # the Kronecker product + # 5. Reshape the result to kron's shape, which is same as + # product of shapes of the two arrays. b = asanyarray(b) a = array(a, copy=False, subok=True, ndmin=b.ndim) is_any_mat = isinstance(a, matrix) or isinstance(b, matrix) |