Esempio n. 1
0
def test_unknown_options_or_solver():
    c = np.array([-3,-2])
    A_ub = [[2,1], [1,1], [1,0]]
    b_ub = [10,8,4]

    _assert_warns(OptimizeWarning, linprog,
                  c, A_ub=A_ub, b_ub=b_ub, options=dict(spam='42'))

    assert_raises(ValueError, linprog,
                  c, A_ub=A_ub, b_ub=b_ub, method='ekki-ekki-ekki')
 def test_logm_exactly_singular(self):
     A = np.array([[0, 0], [1j, 1j]])
     B = np.asarray([[1, 1], [0, 0]])
     for M in A, A.T, B, B.T:
         expected_warning = _matfuncs_inv_ssq.LogmExactlySingularWarning
         L, info = _assert_warns(expected_warning, logm, M, disp=False)
         E = expm(L)
         assert_allclose(E, M, atol=1e-14)
Esempio n. 3
0
 def test_logm_exactly_singular(self):
     A = np.array([[0, 0], [1j, 1j]])
     B = np.asarray([[1, 1], [0, 0]])
     for M in A, A.T, B, B.T:
         expected_warning = _matfuncs_inv_ssq.LogmExactlySingularWarning
         L, info = _assert_warns(expected_warning, logm, M, disp=False)
         E = expm(L)
         assert_allclose(E, M, atol=1e-14)
Esempio n. 4
0
def test_unknown_options_or_solver():
    c = np.array([-3, -2])
    A_ub = [[2, 1], [1, 1], [1, 0]]
    b_ub = [10, 8, 4]

    _assert_warns(OptimizeWarning,
                  linprog,
                  c,
                  A_ub=A_ub,
                  b_ub=b_ub,
                  options=dict(spam='42'))

    assert_raises(ValueError,
                  linprog,
                  c,
                  A_ub=A_ub,
                  b_ub=b_ub,
                  method='ekki-ekki-ekki')
 def test_logm_nearly_singular(self):
     M = np.array([[1e-100]])
     expected_warning = _matfuncs_inv_ssq.LogmNearlySingularWarning
     L, info = _assert_warns(expected_warning, logm, M, disp=False)
     E = expm(L)
     assert_allclose(E, M, atol=1e-14)
Esempio n. 6
0
 def test_indeterminate_covariance(self):
     # Test that a warning is returned when pcov is indeterminate
     xdata = np.array([1, 2, 3, 4, 5, 6])
     ydata = np.array([1, 2, 3, 4, 5.5, 6])
     _assert_warns(OptimizeWarning, curve_fit, lambda x, a, b: a * x, xdata,
                   ydata)
 def test_indeterminate_covariance(self):
     # Test that a warning is returned when pcov is indeterminate
     xdata = np.array([1, 2, 3, 4, 5, 6])
     ydata = np.array([1, 2, 3, 4, 5.5, 6])
     _assert_warns(OptimizeWarning, curve_fit, lambda x, a, b: a*x, xdata, ydata)
Esempio n. 8
0
 def test_logm_nearly_singular(self):
     M = np.array([[1e-100]])
     expected_warning = _matfuncs_inv_ssq.LogmNearlySingularWarning
     L, info = _assert_warns(expected_warning, logm, M, disp=False)
     E = expm(L)
     assert_allclose(E, M, atol=1e-14)