dot
fn dot<V, T>(V a, V b) -> T
Source: compiler/src/builtin_docs/prelude/math.hy Returns the dot product of two vectors of the same length.
a and b are both tuples or both fixed arrays ([T; N]) of the same
numeric element type (int, float or byte) and length. The result is
the sum of the element-wise products, of the element type. * on tuples
and arrays is element-wise, not a dot product.
Parameters#
| Name | Type |
|---|---|
a | V |
b | V |
Returns#
T
Examples#
use tests::assert;
assert!(dot((1, 2, 3), (4, 5, 6)) == 32);
assert!(dot([1.5, 2.0], [2.0, 4.0]) == 11.0);