dot_product: Calculate the dot product of two vectors.

Description Usage Arguments Value Examples

View source: R/vector_calculations.R

Description

Dot product, or scalar product, is calculated by taking the sum of each element of a vector multiplied with the corresponding element in another vector:

DP(x,y) = Σ( x(i) * y(i) )

This function sums up the scalar multiplication of each element in the vectors, and returns the results.

Usage

1

Arguments

x

A vector.

y

A vector.

Value

The dot product of x and y.

Examples

1
2
dot_product(c(1,2,3,4), c(5,6,7,8))
dot_product(W["loue",], W["hate",])

ajfabry/Statspeare documentation built on Jan. 26, 2020, 7:44 a.m.