Documentation

FirstOrderMethodsOptimization_Beck_2017.Chap01.Definition_1_27

noncomputable def sgn {n : } (x : Fin n) :
Fin n

Definition 1.27: For a vector x in ℝ^n, modeled as Fin n → ℝ, sgn x is the coordinatewise sign vector whose i-th entry is 1 when x i ≥ 0 and -1 when x i < 0.

Instances For
    @[simp]
    theorem sgn_apply {n : } (x : Fin n) (i : Fin n) :
    sgn x i = if 0 x i then 1 else -1

    The coordinates of sgn x are 1 on nonnegative entries of x and -1 on negative ones.