def test_high_accuracy_nonneg(): [x, status, hist] = l1ls_nonneg(A, y, lmbda, tar_gap=rel_tol / 10) assert_allclose(x, answer_high_accuracy_nonneg, atol=1e-5) expect(hist.shape).to_equal((15, 5)) expect(status).to_equal('Solved')
def test_small_example_sparse_nonneg(): [x, status, hist] = l1ls_nonneg(S.csr_matrix(A), y, lmbda, tar_gap=rel_tol) assert_allclose(x, answer_nonneg, atol=1e-5) expect(hist.shape).to_equal((12, 5)) expect(status).to_equal('Solved')
def test_small_example_nonneg_zero(): [x, status, hist] = l1ls_nonneg(A, np.zeros_like(y), lmbda, tar_gap=rel_tol) expect(status).to_equal('Failed')
def test_high_accuracy_nonneg(): [x, status, hist] = l1ls_nonneg(A, y, lmbda, tar_gap=rel_tol / 10) assert_allclose(x, answer_high_accuracy_nonneg, atol=1e-5) expect(hist.shape).to_equal((15, 5)) expect(status).to_equal("Solved")
def test_small_example_sparse_nonneg(): [x, status, hist] = l1ls_nonneg(S.csr_matrix(A), y, lmbda, tar_gap=rel_tol) assert_allclose(x, answer_nonneg, atol=1e-5) expect(hist.shape).to_equal((12, 5)) expect(status).to_equal("Solved")
def test_small_example_nonneg_zero(): [x, status, hist] = l1ls_nonneg(A, np.zeros_like(y), lmbda, tar_gap=rel_tol) expect(status).to_equal("Failed")