Learn R Programming

rkeops (version 2.2.2)

sumsoftmaxweight: Sum of weighted Soft-Max reduction.

Description

Sum of weighted Soft-Max reduction.

Sum of weighted Soft-Max reduction.

Usage

sumsoftmaxweight(x, index, weight)

sumsoftmaxweight_reduction(x, index, weight)

Value

a matrix corresponding to the Sum of weighted Soft-Max reduction.

Arguments

x

a LazyTensor or a ComplexLazyTensor.

index

a character corresponding to the reduction dimension that should be either "i" or "j" to specify whether if the reduction is indexed by "i" or "j".

weight

an optional object (LazyTensor or ComplexLazyTensor) that specifies scalar or vector-valued weights.

Author

Chloe Serre-Combe, Amelie Vernay

Details

If x is a LazyTensor or a ComplexLazyTensor, sumsoftmaxweight(x, index, weight) will:

  • if index = "i", return the Sum of weighted Soft-Max reduction of x over the i indexes;

  • if index = "j", return the Sum of weighted Soft-Max reduction of x over the j indexes.

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

Examples

Run this code
if (FALSE) {
x <- matrix(runif(150 * 3), 150, 3) 
x_i <- LazyTensor(x, index = 'i') 
y <- matrix(runif(100 * 3), 100, 3)
y_j <- LazyTensor(y, index = 'j')

V_ij <- x_i - y_j   # weight matrix
S_ij = sum(V_ij^2)     

ssmaxweight <- sumsoftmaxweight(S_ij, 'i', V_ij) # sumsoftmaxweight reduction
                                                 # over the 'i' indices
}
if (FALSE) {
x <- matrix(runif(150 * 3), 150, 3) 
x_i <- LazyTensor(x, index = 'i') 
y <- matrix(runif(100 * 3), 100, 3)
y_j <- LazyTensor(y, index = 'j')

V_ij <- x_i - y_j   # weight matrix
S_ij = sum(V-ij^2)     

# sumsoftmaxweight reduction over the 'i' indices
ssmaxw_red <- sumsoftmaxweight_reduction(S_ij, 'i', V_ij) 

}

Run the code above in your browser using DataLab