[英]How do you multiply each digit of a number by different numbers in python?
[英]Python/Numpy What's it called / how do you represent that operation where you multiply each element of two vectors?
例如,假設我有:
x = array([1, 2, 3])
y = array([4, 5, 6])
python中的標准“數組乘法”確實z = x * y = array([4, 10, 18])
。 在matlab中,為了獲得相同的效果,你可以*。 IIRC。
這個操作叫什么,用什么符號代表它?
它是以開放圈子代表的Hadamard產品: http : //en.wikipedia.org/wiki/Matrix_multiplication#Hadamard_product
在我看來你是在表達式S = sum_i(x_i * y_i)之后? 這被稱為內在產品。 從numpy文檔:
from numpy import *
x = array([1,2,3])
y = array([2,2,2])
inner(x,y) <-- Should give 1*2 + 2*2 + 3*2 = 12
在matlab中,您所說明的操作以及您所獲得的操作被稱為Schur / Hadamard產品,通常使用小圓圈作為符號。 因為這是numpy中普通'''運算符所能得到的,我懷疑是否有單獨的Schur函數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.