Esempio n. 1
0
    def test_append_vectors_big_col(self):
        """Test append_random_vectors() with too many failed trial."""
        row = 10
        vectors = numpy.eye(row, row)
        new_vectors = append_random_vectors(vectors, 1)

        self.assertTrue(numpy.allclose(new_vectors, vectors))
Esempio n. 2
0
    def test_append_random_vectors(self):
        """Test append_random_vectors()."""
        row = 10
        col = 2
        add = 1
        vectors = numpy.eye(row, col)
        new_vectors = append_random_vectors(vectors, add)

        # Identical for the first col columns.
        self.assertTrue(numpy.allclose(new_vectors[:, :col], vectors))

        # Orthonormal.
        self.assertTrue(
            numpy.allclose(numpy.dot(new_vectors.conj().T, new_vectors),
                           numpy.eye(col + add, col + add)))
Esempio n. 3
0
 def test_append_random_vectors_0(self):
     """Test append_random_vectors() with too few columns."""
     vectors = numpy.zeros((10, 2), dtype=complex)
     self.assertTrue(
         numpy.allclose(append_random_vectors(vectors, 0), vectors))