使用 “版本 ”下拉列表切换服务。 了解有关导航的详细信息。
适用于:✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
计算两个数值序列的点积。
函数 series_dot_product() 将两个数值序列用作输入,并计算它们的点积。
语法
series_dot_product(
series1,series2)
替代语法
series_dot_product(
系列, 数字)
series_dot_product(
数字, 系列)
备注
备用语法显示两个函数参数中的一个可以是数值标量。
此数值标量将广播到其长度等于相应数值序列长度的向量。
例如,series_dot_product([1, 2, 3], 10) 将被视为 series_dot_product([1, 2, 3], [10, 10, 10])。
详细了解语法约定。
参数
| 客户 | 类型 | 必需 | 说明 |
|---|---|---|---|
| series1, series2 | dynamic |
✔️ | 包含数值数据的输入数组,将按元素相乘,然后求和以得出 real 类型的值。 |
返回
返回 real 类型的值,其值为 series1 的每个元素与 series2 的相应元素的乘积之和。
如果两个序列长度不相等,则较长的序列将截断为较短序列的长度。
将忽略输入序列的任何非数值元素。
备注
如果一个或两个输入数组为空,则结果为 null。
优化性能
为了提高性能并减少使用此函数时的storage要求,请考虑使用 Vector16 编码策略来存储不需要 64 位精度的浮点矢量,例如 ML 矢量嵌入。 利用Bfloat16浮点表示形式的 Vector16 配置文件可以显著优化作,并将storage大小减少 4 倍。 有关 Vector16 编码策略的更多详细信息,请参阅编码策略类型。
示例
range x from 1 to 3 step 1
| extend y = x * 2
| extend z = y * 2
| project s1 = pack_array(x,y,z), s2 = pack_array(z, y, x)
| extend s1_dot_product_s2 = series_dot_product(s1, s2)
| s1 | s2 | s1_dot_product_s2 |
|---|---|---|
| [1,2,4] | [4,2,1] | 12 |
| [2,4,8] | [8,4,2] | 48 |
| [3,6,12] | [12,6,3] | 108 |
range x from 1 to 3 step 1
| extend y = x * 2
| extend z = y * 2
| project s1 = pack_array(x,y,z), s2 = x
| extend s1_dot_product_s2 = series_dot_product(s1, s2)
| s1 | s2 | s1_dot_product_s2 |
|---|---|---|
| [1,2,4] | 1 | 7 |
| [2,4,8] | 2 | 28 |
| [3,6,12] | 3 | 63 |