dot: Scalar Product

Description Usage Arguments Details Value See Also Examples

View source: R/dot.R

Description

'dot' or 'scalar' product of vectors or pairwise columns of matrices.

Usage

1
  dot(x, y)

Arguments

x

numeric vector or matrix

y

numeric vector or matrix

Details

Returns the 'dot' or 'scalar' product of vectors or columns of matrices. Two vectors must be of same length, two matrices must be of the same size. If x and y are column or row vectors, their dot product will be computed as if they were simple vectors.

Value

A scalar or vector of length the number of columns of x and y.

See Also

cross

Examples

1
2
3
  dot(1:5, 1:5)  #=> 55
  # Length of space diagonal in 3-dim- cube:
  sqrt(dot(c(1,1,1), c(1,1,1)))  #=> 1.732051

Example output

[1] 55
[1] 1.732051

pracma documentation built on Jan. 8, 2020, 5:09 p.m.