vectorDotProduct

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
vectorDotProduct(<firstArray>, <secondArray>)
Summary

Returns the vector dot product of two arrays.

Introduced8.1
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Parameters
NameTypeDescription
firstArray

A single-dimensional array of numbers

secondArray

A single-dimensional array of numbers

Example
put vectorDotProduct(tVector1, tVector2)
Values
NameTypeDescription
return

The vectorDotProduct function returns a number.

The result

The sum of the products of the pair-wise values from both arrays.

RelatedFunction: sum, matrixMultiply
Glossary: function, array, return
Description

Use the vectorDotProduct function to compute the vector dot product of two arrays.

The vector dot product is the sum of the pair-wise product of matching keys from each array. It is equivalent to the following:

put 0 into runningTotal
repeat for each key currentKey in firstArray
    add firstArray[currentKey] * secondArray[currentKey] to runningTotal
end repeat

The names of the keys in firstArray must be the same as names of the keys of secondArray.

Tagsmath