Example #1
0
 def test_normalise_batch(self):
     result = vector4.normalise([
         [1., 1., 1., 1.],
         [-1., -1., -1., 1.],
         [0., 2., 7., 1.],
     ])
     expected = [
         [0.5, 0.5, 0.5, 0.5],
         [-0.5, -0.5, -0.5, 0.5],
         [0., 0.27216553, 0.95257934, 0.13608276],
     ]
     np.testing.assert_almost_equal(result, expected, decimal=5)
Example #2
0
 def test_normalise_batch(self):
     result = vector4.normalise([
         [1.,1.,1.,1.],
         [-1.,-1.,-1.,1.],
         [0.,2.,7.,1.],
     ])
     expected = [
         [0.5, 0.5, 0.5, 0.5],
         [-0.5,-0.5,-0.5, 0.5],
         [0., 0.27216553, 0.95257934, 0.13608276],
     ]
     np.testing.assert_almost_equal(result, expected, decimal=5)
Example #3
0
 def test_normalise_single_vector(self):
     result = vector4.normalise([1., 1., 1., 1.])
     np.testing.assert_almost_equal(result, [0.5, 0.5, 0.5, 0.5], decimal=5)
Example #4
0
 def test_normalise_single_vector(self):
     result = vector4.normalise([1.,1.,1.,1.])
     np.testing.assert_almost_equal(result, [0.5, 0.5, 0.5, 0.5], decimal=5)