UNPKG

837 BMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function dot
4
5Calculate the dot product of two vectors. The dot product of
6`A = [a1, a2, ..., an]` and `B = [b1, b2, ..., bn]` is defined as:
7
8 dot(A, B) = conj(a1) * b1 + conj(a2) * b2 + ... + conj(an) * bn
9
10
11## Syntax
12
13```js
14math.dot(x, y)
15```
16
17### Parameters
18
19Parameter | Type | Description
20--------- | ---- | -----------
21`x` | Array &#124; Matrix | First vector
22`y` | Array &#124; Matrix | Second vector
23
24### Returns
25
26Type | Description
27---- | -----------
28number | Returns the dot product of `x` and `y`
29
30
31## Examples
32
33```js
34math.dot([2, 4, 1], [2, 2, 3]) // returns number 15
35math.multiply([2, 4, 1], [2, 2, 3]) // returns number 15
36```
37
38
39## See also
40
41[multiply](multiply.md),
42[cross](cross.md)