LogSumExp-class function

The LogSumExp class.

The LogSumExp class.

The natural logarithm of the sum of the elementwise exponential, logi=1nexi\log\sum_{i=1}^n e^{x_i}. class

LogSumExp(x, axis = NA_real_, keepdims = FALSE) ## S4 method for signature 'LogSumExp' to_numeric(object, values) ## S4 method for signature 'LogSumExp' .grad(object, values) ## S4 method for signature 'LogSumExp' .column_grad(object, value) ## S4 method for signature 'LogSumExp' sign_from_args(object) ## S4 method for signature 'LogSumExp' is_atom_convex(object) ## S4 method for signature 'LogSumExp' is_atom_concave(object) ## S4 method for signature 'LogSumExp' is_incr(object, idx) ## S4 method for signature 'LogSumExp' is_decr(object, idx)

Arguments

  • x: An Expression representing a vector or matrix.
  • axis: (Optional) The dimension across which to apply the function: 1 indicates rows, 2 indicates columns, and NA indicates rows and columns. The default is NA.
  • keepdims: (Optional) Should dimensions be maintained when applying the atom along an axis? If FALSE, result will be collapsed into an nx1n x 1 column vector. The default is FALSE.
  • object: A LogSumExp object.
  • values: A list of numeric values.
  • value: A numeric value.
  • idx: An index into the atom.

Methods (by generic)

  • to_numeric(LogSumExp): Evaluates exe^x elementwise, sums, and takes the natural log.
  • .grad(LogSumExp): Gives the (sub/super)gradient of the atom w.r.t. each variable
  • .column_grad(LogSumExp): Gives the (sub/super)gradient of the atom w.r.t. each column variable.
  • sign_from_args(LogSumExp): Returns sign (is positive, is negative) of the atom.
  • is_atom_convex(LogSumExp): The atom is convex.
  • is_atom_concave(LogSumExp): The atom is not concave.
  • is_incr(LogSumExp): The atom is weakly increasing in the index.
  • is_decr(LogSumExp): The atom is not weakly decreasing in the index.

Slots

  • x: An Expression representing a vector or matrix.
  • axis: (Optional) The dimension across which to apply the function: 1 indicates rows, 2 indicates columns, and NA indicates rows and columns. The default is NA.
  • keepdims: (Optional) Should dimensions be maintained when applying the atom along an axis? If FALSE, result will be collapsed into an nx1n x 1 column vector. The default is FALSE.
  • Maintainer: Anqi Fu
  • License: Apache License 2.0 | file LICENSE
  • Last published: 2024-11-07