Learn R Programming

rkeops (version 2.2.2)

weightedsqdist: Generic weighted squared distance

Description

Symbolic weighted squared distance binary operation for LazyTensor objects.

Usage

weightedsqdist(x, y, s)

Value

An object of class LazyTensor.

Arguments

x

A vector of numeric values or a scalar value.

y

a LazyTensor, a ComplexLazyTensor, a vector of numeric values, or a scalar value.

s

a LazyTensor, a ComplexLazyTensor, a vector of numeric values, or a scalar value.

Author

Chloe Serre-Combe, Amelie Vernay

Details

weightedsqdist(x, y, s) returns a LazyTensor that encodes, symbolically, the weighted squared distance of a vector x with weights stored in the LazyTensor s, same as weightedsqnorm(x - y, s).

Note: x, y and s should all have the same inner dimension.

Note: Run browseVignettes("rkeops") to access the vignettes and find details about this function in the "RKeOps LazyTensor" vignette, at section "Simple vector operations".

See Also

weightedsqnorm(), sqdist()

Examples

Run this code
if (FALSE) {
x <- matrix(runif(100 * 3), 100, 3) # arbitrary R matrix, 100 rows, 3 columns
y <- matrix(runif(100 * 3), 100, 3) # arbitrary R matrix, 100 rows, 3 columns
s <- matrix(runif(100 * 3), 100, 3) # arbitrary R matrix, 100 rows, 3 columns

x_i <- LazyTensor(x, index = 'i')   # creating LazyTensor from matrix x, 
                                    # indexed by 'i'
y_j <- LazyTensor(y, index = 'j')   # creating LazyTensor from matrix y, 
                                    # indexed by 'j'
s_i <- LazyTensor(s, index = 'i')   # creating LazyTensor from matrix s, 
                                    # indexed by 'i'

wsqd_xy <- weightedsqdist(x_i, y_j, s_i)    # symbolic matrix
}

Run the code above in your browser using DataLab