Qu

dot

Builtin index · Core maths

result = dot(a, b)

Input: a, b · Output: result

What it is

Dot product of two equal-length vectors a, b (each a Vec; a length mismatch errors).

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = dot(a, b)
a —a length mismatch errors).
b vector or VecDot product of two equal-length vectors a, b (each a Vec.
result scalar or Num
Returns a scalar Num, sum(a_i * b_i).

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

a = [1, 2, 2]
print("dot(a,a) = {dot(a,a)}")   # 9

print("norm(a) = {norm(a)}")     # 3

output
dot(a,a) = 9
norm(a) = 3

from numerics-dsp