函数 dot #
计算两个向量的点积。向量 A = [a1, a2, ..., an] 和 B = [b1, b2, ..., bn] 的点积定义为
dot(A, B) = conj(a1) * b1 + conj(a2) * b2 + … + conj(an) * bn
Syntax #
math.dot(x, y)
Parameters #
| Parameter | Type | Description |
|---|---|---|
x |
Array | Matrix | 第一个向量 |
y |
Array | Matrix | 第二个向量 |
Returns #
| Type | Description |
|---|---|
| number | 返回 x 和 y 的点积 |
Throws #
Type | Description —- | ———–
Examples #
math.dot([2, 4, 1], [2, 2, 3]) // returns number 15
math.multiply([2, 4, 1], [2, 2, 3]) // returns number 15