series_dot_product_fl()

Calculates the dot product of two numerical vectors.

The function series_dot_product_fl() takes an expression containing two dynamic numerical arrays as input and calculates their dot product.

Note

This function is a UDF (user-defined function). For more information, see usage.

Syntax

series_dot_product_fl(vec1, vec2)

Arguments

  • vec1: Dynamic array cell of numeric values.
  • vec2: Dynamic array cell of numeric values, same length as vec1.

Usage

series_dot_product_fl() is a user-defined function. You can either embed its code in your query, or install it in your database. There are two usage options: ad hoc and persistent usage. See the below tabs for examples.

For ad hoc usage, embed its code using a let statement. No permission is required.

let series_dot_product_fl=(vec1:dynamic, vec2:dynamic)
{
    let elem_prod = series_multiply(vec1, vec2);
    let cum_sum = series_iir(elem_prod, dynamic([1]), dynamic([1,-1]));
    todouble(cum_sum[-1])
};
//
union
(print 1 | project v1=range(1, 3, 1), v2=range(4, 6, 1)),
(print 1 | project v1=range(11, 13, 1), v2=range(14, 16, 1))
| extend v3=series_dot_product_fl(v1, v2)

Table showing the result of dot product of 2 vectors using user-defined function series_dot_product_fl in Azure Data Explorer.