def test_normalisation(self): r = np.random.rand(100,3) n = norm_vect(r) d = dot_product(n,n) ones = np.ones((100)) assert_almost_equal(d, ones, 8, err_msg="Your vectors don't normalise too well")
def test_block_vect(self): r = np.random.rand(100, 3) d = dot_product(r, r) r_sqar = np.power(r[:,:], 2) r_sum = np.sum(r_sqar[:,:], axis=1) assert_equal(np.shape(d), np.shape(r_sum), err_msg="The shape of the final dot product is not right") assert_almost_equal(d[:], r_sum[:], 8, err_msg="The dot_product sum does not add up (funny, huh?)")
def test_sum_vect(self): r = np.array(([[1,2,3]])) d = dot_product(r,r) assert_equal(d, 14, err_msg="sum in dot_product is broken")
def _dim_vect(self,r): d = dot_product(r,r) assert_equal( d, 4, err_msg="dot_product is in 1 dimension broken")