Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


mixAR (version 0.22.8)

inner: Generalised inner product and methods for class "MixComp"

Description

Generalised inner product and methods for class MixComp. The methods for MixComp provide for very convenient computing with MixAR models.

Usage

inner(x, y, star = "*", plus = .mplus)

Value

the inner product, the type of the result depends on the arguments

Arguments

x

the first argument.

y

the second argument.

star

function to apply to pairs of elements from x and y, default is multiplication, as for the usual inner product.

plus

function to apply to combine the results from the pairs, default is addition, as for the usual inner product.

Methods

Methods for inner product between a "MixComp" object and a vector are similar to a product between a matrix and a vector but comply with the conventions of class "MixComp". For this reason they are described in the help page for class "MixComp", along with methods for other functions and operators applied to "MixComp" objects.

signature(x = "ANY", y = "ANY", star = "ANY", plus = "ANY")

This is the default method, see section Details.

signature(x = "MixComp", y = "missing", star = "missing", plus = "missing")

see "MixComp".

signature(x = "MixComp", y = "numeric", star = "missing", plus = "missing")

see "MixComp".

signature(x = "numeric", y = "MixComp", star = "missing", plus = "missing")

see "MixComp".

signature(x = "MixComp", y = "numeric", star = "ANY", plus = "ANY")

see "MixComp".

signature(x = "MixComp", y = "numeric", star = "ANY", plus = "missing")

see "MixComp".

Details

inner computes a generalised inner product x . y, where multiplication and summation can be replaced by other functions.

The default method of inner applies star to the corresponding pairs of elements and combines them with plus. There is no recycling, if x and y have different lengths, an error is raised. The elements of x and y are accessed with "[[". plus should be an n-ary operation.

See Also

"MixComp"

Examples

Run this code
inner(1:3, 2:4) # [1] 20
class(inner(1:3, 2:4)) # [1] "integer"
## compare to:
1:3 %*% 2:4        # 20, but (1,1)-matrix
class(1:3 %*% 2:4) # matrix

Run the code above in your browser using DataLab