scalar: Parallel scalar products

View source: R/compositions.R

scalarR Documentation

Parallel scalar products

Description

Computes scalar products of datasets of vectors or vectorial quantities.

Usage

scalar(x,y)
## Default S3 method:
scalar(x,y)
          

Arguments

x

a vector or a matrix with rows considered as vectors

y

a vector or a matrix with rows considered as vectors

Details

The scalar product of two vectors is defined as:

scalar(x,y):= \sum(x_iy_i)

Value

a numerical vector containing the scalar products of the vectors given by x and y. If both x and y contain more than one vector the function uses parallel operation like it would happen with an ordinary product of vectors.

Note

The computation of the scalar product implicitly applies the cdt transform, which implies that the scalar products corresponding to the given geometries are returned for acomp, rcomp, aplus, rplus-objects. Even a useful scalar product for factors is induced in this way.

Author(s)

K.Gerald v.d. Boogaart http://www.stat.boogaart.de

Examples

scalar(acomp(c(1,2,3)),acomp(c(1,2,3)))
scalar(rmult(c(1,2,3)),rmult(c(1,2,3)))

compositions documentation built on June 22, 2024, 12:15 p.m.