Commit 6ce6f1a4 authored by Matevz, Sraml (sraml)'s avatar Matevz, Sraml (sraml)

updated tests 2#

parent eda41eeb
Pipeline #14116 failed with stage
in 5 minutes and 46 seconds
...@@ -9,6 +9,7 @@ from itertools import product ...@@ -9,6 +9,7 @@ from itertools import product
from test.common import expand from test.common import expand
from test.common import generate_spaces from test.common import generate_spaces
np.random.seed(42)
class ConjugateGradient_Tests(unittest.TestCase): class ConjugateGradient_Tests(unittest.TestCase):
...@@ -39,9 +40,9 @@ class ConjugateGradient_Tests(unittest.TestCase): ...@@ -39,9 +40,9 @@ class ConjugateGradient_Tests(unittest.TestCase):
convergence_level): convergence_level):
x0 = Field.from_random('normal', domain=space) x0 = Field.from_random('normal', domain=space)
test_x = Field(space, val = 0.) test_x = Field(space, val = 1.)
A = DiagonalOperator(space, diagonal = 1.) A = DiagonalOperator(space, diagonal = 1.)
b = Field(space, val=0.) b = Field(space, val=1.)
minimizer = ConjugateGradient(iteration_limit=iteration_limit, minimizer = ConjugateGradient(iteration_limit=iteration_limit,
convergence_tolerance=convergence_tolerance, convergence_tolerance=convergence_tolerance,
...@@ -50,7 +51,7 @@ class ConjugateGradient_Tests(unittest.TestCase): ...@@ -50,7 +51,7 @@ class ConjugateGradient_Tests(unittest.TestCase):
(position, convergence) = minimizer(A=A, x0=x0, b=b) (position, convergence) = minimizer(A=A, x0=x0, b=b)
assert_almost_equal(position.val.get_full_data(), assert_almost_equal(position.val.get_full_data(),
test_x.val.get_full_data(), significant=3) test_x.val.get_full_data(), decimal=3)
assert_equal(convergence, convergence_level+1) assert_equal(convergence, convergence_level+1)
...@@ -9,6 +9,7 @@ from itertools import product ...@@ -9,6 +9,7 @@ from itertools import product
from test.common import expand from test.common import expand
from test.common import generate_spaces from test.common import generate_spaces
np.random.seed(42)
class QuadraticPot(Energy): class QuadraticPot(Energy):
...@@ -76,9 +77,9 @@ class RelaxedNewton_Tests(unittest.TestCase): ...@@ -76,9 +77,9 @@ class RelaxedNewton_Tests(unittest.TestCase):
(energy, convergence) = minimizer(energy) (energy, convergence) = minimizer(energy)
assert_almost_equal(energy.value, 0, significant=3) assert_almost_equal(energy.value, 0, decimal=3)
assert_almost_equal(energy.position.val.get_full_data(), assert_almost_equal(energy.position.val.get_full_data(),
test_x.val.get_full_data(), significant=3) test_x.val.get_full_data(), decimal=3)
assert_equal(convergence, convergence_level+2) assert_equal(convergence, convergence_level+2)
......
...@@ -76,7 +76,7 @@ class SteepestDescent_Tests(unittest.TestCase): ...@@ -76,7 +76,7 @@ class SteepestDescent_Tests(unittest.TestCase):
(energy, convergence) = minimizer(energy) (energy, convergence) = minimizer(energy)
assert_almost_equal(energy.value, 0, significant=3) assert_almost_equal(energy.value, 0, decimal=3)
assert_almost_equal(energy.position.val.get_full_data(), assert_almost_equal(energy.position.val.get_full_data(),
test_x.val.get_full_data(), significant=3) test_x.val.get_full_data(), decimal=3)
assert_equal(convergence, convergence_level+2) assert_equal(convergence, convergence_level+2)
...@@ -8,6 +8,7 @@ from itertools import product ...@@ -8,6 +8,7 @@ from itertools import product
from test.common import expand from test.common import expand
from test.common import generate_spaces from test.common import generate_spaces
np.random.seed(42)
class QuadraticPot(Energy): class QuadraticPot(Energy):
...@@ -75,8 +76,8 @@ class VL_BFGS_Tests(unittest.TestCase): ...@@ -75,8 +76,8 @@ class VL_BFGS_Tests(unittest.TestCase):
(energy, convergence) = minimizer(energy) (energy, convergence) = minimizer(energy)
assert_almost_equal(energy.value, 0, significant=3) assert_almost_equal(energy.value, 0, decimal=3)
assert_almost_equal(energy.position.val.get_full_data(), assert_almost_equal(energy.position.val.get_full_data(),
test_x.val.get_full_data(), significant=3) test_x.val.get_full_data(), decimal=3)
assert_equal(convergence, convergence_level) assert_equal(convergence, convergence_level)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment