线性代数向量内积
Prerequisites:
先决条件:
Learn: how to code for outer product of two vectors using am inbuilt function in numpy library?
了解:如何使用numpy库中的内置函数为两个向量的外部乘积编码?
Syntax:
句法:
numpy.outer(Vec_1, Vec_2)
向量外积的Python代码 (Python code for outer product of vectors)
# Linear Algebra Learning Sequence
# Outer Product
import numpy as np
a = np.array([2,3,4,1])
b = np.array([5,4,-6,45,7])
outpro = np.outer(a,b)
print('Vector A : ', a)
print('Vector B : ', b)
print('Outer product of Vector A and Vector B :', outpro)
Output:
输出:
Vector A : [2 3 4 1]
Vector B : [ 5 4 -6 45 7]
Outer product of Vector A and Vector B : [[ 10 8 -12 90 14]
[ 15 12 -18 135 21]
[ 20 16 -24 180 28]
[ 5 4 -6 45 7]]
翻译自: https://www.includehelp.com/python/outer-product-of-vectors.aspx
线性代数向量内积