def test_norm_vector_n2(self): itq = ItqFunctor(normalize=2) v = numpy.array([1, 0]) numpy.testing.assert_array_almost_equal(itq._norm_vector(v), [1, 0]) v = numpy.array([1, 1]) numpy.testing.assert_array_almost_equal(itq._norm_vector(v), [1. / sqrt(2), 1. / sqrt(2)])
def test_norm_vector_no_normalization(self): itq = ItqFunctor(normalize=None) v = numpy.array([0, 1]) numpy.testing.assert_array_equal(itq._norm_vector(v), v) v = numpy.array([[0, 1, 1, .4, .1]]) numpy.testing.assert_array_equal(itq._norm_vector(v), v) v = numpy.array([0] * 128) numpy.testing.assert_array_equal(itq._norm_vector(v), v)
def test_norm_vector_no_normalization(self): itq = ItqFunctor(normalize=None) v = numpy.array([0, 1]) numpy.testing.assert_array_equal(itq._norm_vector(v), v) v = numpy.array([[0, 1, 1, .4, .1]]) numpy.testing.assert_array_equal(itq._norm_vector(v), v) v = numpy.array([0]*128) numpy.testing.assert_array_equal(itq._norm_vector(v), v)
def test_norm_vector_n2(self): itq = ItqFunctor(normalize=2) v = numpy.array([1, 0]) numpy.testing.assert_array_almost_equal( itq._norm_vector(v), [1, 0] ) v = numpy.array([1, 1]) numpy.testing.assert_array_almost_equal( itq._norm_vector(v), [1./sqrt(2), 1./sqrt(2)] )