cr.sparse.opt.SmoothFunction

class cr.sparse.opt.SmoothFunction(func: Callable[[jax.Array], float], grad: Callable[[jax.Array, float], jax.Array], grad_val: Callable[[jax.Array, float], Tuple[float, jax.Array]])[source]

Represents a smooth function

Let op be a variable of type SmoothFunction which represents some smooth function \(f\). Then:

  • op.func(x) returns the function value \(f(x)\).

  • op.grad(x) returns the gradient of function \(g(x) = \nabla f(x)\).

  • op.grad_val(x) returns the pair \((g(x), f(x))\).

Attributes

func

Definition of a smooth function

grad

Definition of a gradient the function

grad_val

A wrapper to evaluate the gradient vector and the function value together