docstr: ...Test of ProxL2Sq
          
docstr_tok: ["...","Test","of","ProxL2Sq"]
code: def test_ProxL2Sq(self):
      """...Test of ProxL2Sq"""
      coeffs = self.coeffs.copy().astype(self.dtype)
  
      l_l2sq = 3e-2
      t = 1.7
  
      prox = ProxL2Sq(l_l2sq).astype(self.dtype)
      out = coeffs.copy()
      out *= 1.0 / (1.0 + t * l_l2sq)
      self.assertAlmostEqual(
          prox.value(coeffs),
          0.5 * l_l2sq * norm(coeffs) ** 2.0,
          delta=self.delta,
      )
      assert_almost_equal(
          prox.call(coeffs, step=t), out, decimal=self.decimal_places
      )
  
      prox = ProxL2Sq(l_l2sq, (3, 8)).astype(self.dtype)
      out = coeffs.copy()
      out[3:8] *= 1.0 / (1.0 + t * l_l2sq)
      self.assertAlmostEqual(
          prox.value(coeffs),
          0.5 * l_l2sq * norm(coeffs[3:8]) ** 2.0,
          delta=self.delta,
      )
      assert_almost_equal(
          prox.call(coeffs, step=t), out, decimal=self.decimal_places
      )
  
      prox = ProxL2Sq(l_l2sq, (3, 8), positive=True).astype(self.dtype)
      out = coeffs.copy()
      out[3:8] *= 1.0 / (1.0 + t * l_l2sq)
      idx = out[3:8] < 0
      out[3:8][idx] = 0
      self.assertAlmostEqual(
          prox.value(coeffs),
          0.5 * l_l2sq * norm(coeffs[3:8]) ** 2.0,
          delta=self.delta,
      )
      assert_almost_equal(
          prox.call(coeffs, step=t), out, decimal=self.decimal_places
      )
  
      prox = ProxL2Sq(l_l2sq, (3, 8)).astype(self.dtype)
      out = coeffs.copy()
      t = np.linspace(1, 10, 5).astype(self.dtype)
      out[3:8] *= 1.0 / (1.0 + t * l_l2sq)
      self.assertAlmostEqual(
          prox.value(coeffs),
          0.5 * l_l2sq * norm(coeffs[3:8]) ** 2.0,
          delta=self.delta,
      )
      assert_almost_equal(
          prox.call(coeffs, t), out, decimal=self.decimal_places
      )
  
file_path: tick/tick/prox/tests/prox_l2sq_test.py
imports: import unittest
  import numpy
  from numpy.linalg import norm
  from numpy.testing import assert_almost_equal
  from tick.prox import ProxL2Sq
  from tick.prox.tests.prox import TestProx
label_desc: Use image node_id 1 for calling the ProxL2SqTest obj's underlying member method code with example usage: obj.test_ProxL2Sq() without return types