class TestMatrixOperator(QiskitOpflowTestCase): """MatrixOperator tests.""" def setUp(self): super().setUp() seed = 0 aqua_globals.random_seed = seed self.num_qubits = 3 m_size = np.power(2, self.num_qubits) matrix = aqua_globals.random.random((m_size, m_size)) self.qubit_op = MatrixOperator(matrix=matrix) def test_num_qubits(self): """ num qubits test """ op = MatrixOperator(matrix=np.zeros((2, 2))) self.assertEqual(op.num_qubits, 0) self.assertEqual(self.qubit_op.num_qubits, self.num_qubits) def test_is_empty(self): """ is empty test """ op = MatrixOperator(matrix=np.zeros((2, 2))) self.assertTrue(op.is_empty()) self.assertFalse(self.qubit_op.is_empty())
def test_is_empty(self): """ is empty test """ op = MatrixOperator(matrix=np.zeros((2, 2))) self.assertTrue(op.is_empty()) self.assertFalse(self.qubit_op.is_empty())