residual()#

L2Solver.residual(X)[source]#

Calculate the residual of the regularized problem for each column of B = [ b_1 | … | b_r ], i.e., ||Ax_i - b_i||_2^2 + ||λx_i||_2^2.

Parameters
X(d, r) ndarray

Least-squares solution X = [ x_1 | … | x_r ]; each column is the solution to the subproblem with the corresponding column of B.

regularizerfloat ≥ 0

Scalar regularization hyperparameter.

Returns
resids(r,) ndarray or float (r = 1)

Residuals ||Ax_i - b_i||_2^2 + ||λx_i||_2^2, i = 1, …, r.