gradient: Access the gradient of a Variable or Parameter

View source: R/304_zzz_R_specific_grad_delta_attrs.R

gradientR Documentation

Access the gradient of a Variable or Parameter

Description

Used by psolve() with requires_grad = TRUE and Problem$backward(). Stores a numeric array of the same shape as the leaf, or NULL (the default).

Usage

gradient(x)

gradient(x) <- value

Arguments

x

A Variable or Parameter.

value

A numeric array of the same shape as x, or NULL.

Value

The gradient (numeric array) or NULL.


CVXR documentation built on Aug. 24, 2026, 9:10 a.m.