আউটার প্রোডাক্ট: বহুমাত্রিক অ্যারে (ফ্ল্যাটেন হয়ে)
numpy.outer() ফাংশন ইনপুট অ্যারেগুলো ফ্ল্যাটেন করে (১-ডি বানিয়ে) আউটার প্রোডাক্ট গণনা করে।
উদাহরণ: ২x২ ম্যাট্রিক্স দুটি
import numpy as np
arr1 = np.array([[5, 10], [15, 20]])
arr2 = np.array([[6, 12], [18, 24]])
print("Array1...\n", arr1)
print("\nArray2...\n", arr2)
print("\nDimensions of Array1...\n", arr1.ndim)
print("\nDimensions of Array2...\n", arr2.ndim)
print("\nShape of Array1...\n", arr1.shape)
print("\nShape of Array2...\n", arr2.shape)
result = np.outer(arr1, arr2)
print("\nOuter Product Result (flattened):\n", result)
আউটপুট
Array1...
[[ 5 10]
[15 20]]
Array2...
[[ 6 12]
[18 24]]
Dimensions of Array1... 2
Dimensions of Array2... 2
Shape of Array1... (2, 2)
Shape of Array2... (2, 2)
Outer Product Result (flattened):
[[ 30 60 90 120]
[ 60 120 180 240]
[ 90 180 270 360]
[120 240 360 480]]