Skip to main content

projected_gd_step

Function projected_gd_step 

Source
pub fn projected_gd_step(
    x: &[f64],
    grad: &[f64],
    lr: f64,
    lower: &[f64],
    upper: &[f64],
) -> Result<Vec<f64>, String>
Expand description

Projected gradient descent step with box constraints.

Computes: project(x - lr * grad, lower, upper)

All arrays must have the same length.