def test_inflate(self): st = SingleTransform([0, 0, 0, 0, 0, 0]) st.inflate(reshape(matrix([1, 0, 0, 0, 0, 0], float), (-1, 1))) expected = numpy.matrix( [[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], float) print "" print st.transform self.assertAlmostEqual(numpy.linalg.norm(st.transform - expected), 0.0, 6)
def test_inflate(self): st = SingleTransform([0, 0, 0, 0, 0, 0]) st.inflate( reshape( matrix([1, 0, 0, 0, 0, 0], float), (-1,1) )) expected = numpy.matrix( [[ 1, 0, 0, 1], [ 0, 1, 0, 0], [ 0, 0, 1, 0], [ 0, 0, 0, 1]], float ) print "" print st.transform self.assertAlmostEqual(numpy.linalg.norm(st.transform-expected), 0.0, 6)
def test_deflate(self): st = SingleTransform([0, 0, 0, 0, 0, 0]) p = reshape(matrix([1, 0, 0, 0, 0, 0], float), (-1, 1)) st.inflate(p) result = st.deflate() self.assertAlmostEqual(numpy.linalg.norm(p - result), 0.0, 6)
def test_deflate(self): st = SingleTransform([0, 0, 0, 0, 0, 0]) p = reshape( matrix([1, 0, 0, 0, 0, 0], float), (-1,1) ) st.inflate(p) result = st.deflate() self.assertAlmostEqual(numpy.linalg.norm(p-result), 0.0, 6)