Inner product of two multivariate functional data objects, for each observation

inprod_mfd_diag(mfdobj1, mfdobj2 = NULL)

Arguments

mfdobj1

A multivariate functional data object of class mfd.

mfdobj2

A multivariate functional data object of class mfd, with the same number of functional variables and observations as mfdobj1. If NULL, then mfdobj2=mfdobj1. Default is NULL.

Value

It calculates the inner product of two multivariate functional data objects. The main function inprod of the package fda

calculates inner products among all possible couples of observations. This means that, if mfdobj1 has n1 observations and mfdobj2 has n2 observations, then for each variable n1 X n2 inner products are calculated. However, often one is interested only in calculating the n inner products between the n observations of mfdobj1 and the corresponding n

observations of mfdobj2. This function provides this "diagonal" inner products only, saving a lot of computation with respect to using fda::inprod and then extracting the diagonal elements. Note that the code of this function calls a modified version of fda::inprod().

Examples

mfdobj <- data_sim_mfd()
inprod_mfd_diag(mfdobj)
#>           [,1]      [,2]
#> rep1 0.1460100 0.1132987
#> rep2 0.6338512 0.6130826
#> rep3 0.1701702 0.4554028
#> rep4 0.3491428 1.3387283
#> rep5 0.3957713 0.6253706