Пример #1
0
    def test_reduction_vector(self, n):
        """Check kron reduced returns correct result"""
        res = reduction(np.array([0, 1]), [n, n])

        O = np.zeros([n, n])
        J = np.ones([n, n])
        ex = np.hstack([O, J])
        assert np.all(res == ex)
Пример #2
0
    def test_reduction(self, n):
        """Check kron reduced returns correct result"""
        res = reduction(np.array([[0, 1], [1, 0]]), [n, n])

        O = np.zeros([n, n])
        B = np.ones([n, n])
        ex = np.vstack([np.hstack([O, B]), np.hstack([B, O])])

        assert np.all(res == ex)