def test_transformation_interval(self, points, params):
     manual_transformation = RotationZX()
     auto_transformation = Composition(RotationZ(), RotationX())
     self.assertSound(manual_transformation.transform(points, params),
                      params,
                      partial(manual_transformation.transform, points))
     self.assertSound(auto_transformation.transform(points, params), params,
                      partial(auto_transformation.transform, points))
 def test_taylor_approximation(self, x, params):
     manual_transformation = RotationZX()
     auto_transformation = Composition(RotationZ(), RotationX())
     manual = taylor.encode(manual_transformation, x, params)
     auto = taylor.encode(auto_transformation, x, params)
     self.assertSound(manual, params,
                      partial(manual_transformation.transform, x))
     self.assertSound(auto, params, partial(auto_transformation.transform,
                                            x))
    def test_taylor_approximation(self, x, params):
        manual_transformation = TaperingRotation()
        auto_transformation = Composition(TaperingZ(), RotationZ())
        expected = taylor.encode(manual_transformation, x, params)
        actual = taylor.encode(auto_transformation, x, params)

        self.assertSound(expected, params,
                         partial(manual_transformation.transform, x))
        self.assertSound(actual, params,
                         partial(auto_transformation.transform, x))
        self.assertAlmostEqualBounds(expected, actual)
 def transform(self, points: np.ndarray, params: Union[List[float], List[Interval]]) -> Union[np.ndarray, Interval]:
     a, b, theta = params
     return TaperingZ().transform(RotationZ().transform(points, [theta]), [a, b])
Exemple #5
0
 def test_transformation_interval(self, x, params):
     transformation = RotationZ()
     actual = transformation.transform(x, params)
     self.assertSound(actual, params, partial(transformation.transform, x))
Exemple #6
0
 def test_transformation_float(self, x, alpha):
     transformation = RotationZ()
     expected = rotate_z(x, alpha.item())
     actual = transformation.transform(x, alpha)
     self.assertAlmostEqualNumpy(expected, actual)
Exemple #7
0
 def test_transformation_taylor(self, x, params):
     transformation = RotationZ()
     actual = taylor.encode(transformation, x, params)
     self.assertSound(actual, params, partial(transformation.transform, x))
 def test_taylor_twisting_rotation(self, x, params):
     transformation = Composition(TwistingZ(), RotationZ())
     actual = taylor.encode(transformation, x, params)
     self.assertSound(actual, params, partial(transformation.transform, x))
 def test_hessian_points_params_float(self, points, params):
     expected = RotationZX().hessian_points_params(points, params)
     actual = Composition(RotationZ(), RotationX()).hessian_points_params(
         points, params)
     self.assertAlmostEqualList(expected, actual)
Exemple #10
0
 def test_hessian_points_params_interval(self, points, params):
     expected = TaperingRotation().hessian_points_params(points, params)
     actual = Composition(TaperingZ(), RotationZ()).hessian_points_params(
         points, params)
     self.assertAlmostEqualList(expected, actual)
Exemple #11
0
 def test_transformation_float(self, points, params):
     manual_transformation = RotationZX()
     auto_transformation = Composition(RotationZ(), RotationX())
     expected = manual_transformation.transform(points, params)
     actual = auto_transformation.transform(points, params)
     self.assertAlmostEqualNumpy(expected, actual)
Exemple #12
0
 def test_gradient_points_float(self, points, params):
     expected = TaperingRotation().gradient_points(points, params)
     actual = Composition(TaperingZ(),
                          RotationZ()).gradient_points(points, params)
     self.assertAlmostEqualList(expected, actual)
Exemple #13
0
 def test_transformation_interval(self, points, params):
     expected = TaperingRotation().transform(points, params)
     actual = Composition(TaperingZ(),
                          RotationZ()).transform(points, params)
     self.assertAlmostEqualInterval(expected, actual)
Exemple #14
0
 def test_taylor_rot_zyx(self, x, params):
     transformation = Composition(RotationZ(),
                                  Composition(RotationY(), RotationX()))
     actual = taylor.encode(transformation, x, params)
     self.assertSound(actual, params, partial(transformation.transform, x))