Skip to contents

Functions of two expression arguments.

Usage

sd_elementwise_mult(l, r)
sd_matmul(x, y)
sd_quad_over_lin(l, r)
sd_rel_entr(l, r)
sd_rel_entr_first_scalar(l, r)
sd_rel_entr_second_scalar(l, r)
sd_atan2(y, x)

Arguments

l, r, x, y

expression handles.

Value

An expression handle.

Details

sd_elementwise_mult

elementwise (Hadamard) product.

sd_matmul

matrix product \(x y\).

sd_quad_over_lin

the quadratic-over-linear \(\lVert x \rVert^2 / y\).

sd_rel_entr

relative entropy \(x \log(x / y)\). Like 'sparsediffpy' make_rel_entr, it dispatches on operand size: a scalar l with a non-scalar r uses sd_rel_entr_first_scalar, the reverse uses sd_rel_entr_second_scalar, and otherwise it is elementwise.

sd_rel_entr_first_scalar, sd_rel_entr_second_scalar

relative entropy with a scalar first or second argument broadcast against the other.

sd_atan2

the elementwise two-argument inverse tangent \(\mathrm{atan2}(y, x)\), the angle of the point \((x, y)\); note the argument order, y first.

The relative entropies and sd_atan2 take two different variables (sd_variable) as their arguments, not composite expressions, and sd_atan2 needs them to have the same shape; anything else is an error. The denominator r of sd_quad_over_lin must be a scalar variable, different from the numerator; anything else is an error. Its numerator l may be a composite expression that does not involve r, but the engine then has the Jacobian only: the Hessian needs a variable numerator.