# -*- coding: utf-8 -*-

# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# pylint: disable=invalid-name

"""Tests for Operator matrix linear operator class."""

import unittest
import logging
import copy
import numpy as np
from numpy.testing import assert_allclose
import scipy.linalg as la

from qiskit import QiskitError
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit.extensions.standard import HGate, CHGate, CXGate
from qiskit.test import QiskitTestCase
from qiskit.quantum_info.operators.operator import Operator
from qiskit.quantum_info.operators.predicates import matrix_equal

logger = logging.getLogger(__name__)


class OperatorTestCase(QiskitTestCase):
    """Test utils for Operator"""

    # Pauli-matrix unitaries
    UI = np.eye(2)
    UX = np.array([[0, 1], [1, 0]])
    UY = np.array([[0, -1j], [1j, 0]])
    UZ = np.diag([1, -1])
    UH = np.array([[1, 1], [1, -1]]) / np.sqrt(2)

    @classmethod
    def rand_rho(cls, n):
        """Return random density matrix"""
        seed = np.random.randint(0, np.iinfo(np.int32).max)
        logger.debug("rand_rho RandomState seeded with seed=%s", seed)
        rng = np.random.RandomState(seed)

        psi = rng.rand(n) + 1j * rng.rand(n)
        rho = np.outer(psi, psi.conj())
        rho /= np.trace(rho)
        return rho

    @classmethod
    def rand_matrix(cls, rows, cols=None, real=False):
        """Return a random matrix."""
        seed = np.random.randint(0, np.iinfo(np.int32).max)
        logger.debug("rand_matrix RandomState seeded with seed=%s", seed)
        rng = np.random.RandomState(seed)

        if cols is None:
            cols = rows
        if real:
            return rng.rand(rows, cols)
        return rng.rand(rows, cols) + 1j * rng.rand(rows, cols)

    def simple_circuit_no_measure(self):
        """Return a unitary circuit and the corresponding unitary array."""
        qr = QuantumRegister(3)
        circ = QuantumCircuit(qr)
        circ.h(qr[0])
        circ.x(qr[1])
        circ.ry(np.pi / 2, qr[2])
        y90 = (1 / np.sqrt(2)) * np.array([[1, -1], [1, 1]])
        target = Operator(np.kron(y90, np.kron(self.UX, self.UH)))
        return circ, target

    def simple_circuit_with_measure(self):
        """Return a unitary circuit with measurement."""
        qr = QuantumRegister(2)
        cr = ClassicalRegister(2)
        circ = QuantumCircuit(qr, cr)
        circ.h(qr[0])
        circ.x(qr[1])
        circ.measure(qr, cr)
        return circ


class TestOperator(OperatorTestCase):
    """Tests for Operator linear operator class."""

    def test_init_array_qubit(self):
        """Test subsystem initialization from N-qubit array."""
        # Test automatic inference of qubit subsystems
        mat = self.rand_matrix(8, 8)
        op = Operator(mat)
        assert_allclose(op.data, mat)
        self.assertEqual(op.dim, (8, 8))
        self.assertEqual(op.input_dims(), (2, 2, 2))
        self.assertEqual(op.output_dims(), (2, 2, 2))

        op = Operator(mat, input_dims=8, output_dims=8)
        assert_allclose(op.data, mat)
        self.assertEqual(op.dim, (8, 8))
        self.assertEqual(op.input_dims(), (2, 2, 2))
        self.assertEqual(op.output_dims(), (2, 2, 2))

    def test_init_array(self):
        """Test initialization from array."""
        mat = np.eye(3)
        op = Operator(mat)
        assert_allclose(op.data, mat)
        self.assertEqual(op.dim, (3, 3))
        self.assertEqual(op.input_dims(), (3,))
        self.assertEqual(op.output_dims(), (3,))

        mat = self.rand_matrix(2 * 3 * 4, 4 * 5)
        op = Operator(mat, input_dims=[4, 5], output_dims=[2, 3, 4])
        assert_allclose(op.data, mat)
        self.assertEqual(op.dim, (4 * 5, 2 * 3 * 4))
        self.assertEqual(op.input_dims(), (4, 5))
        self.assertEqual(op.output_dims(), (2, 3, 4))

    def test_init_array_except(self):
        """Test initialization exception from array."""
        mat = self.rand_matrix(4, 4)
        self.assertRaises(QiskitError, Operator, mat, input_dims=[4, 2])
        self.assertRaises(QiskitError, Operator, mat, input_dims=[2, 4])
        self.assertRaises(QiskitError, Operator, mat, input_dims=5)

    def test_init_operator(self):
        """Test initialization from Operator."""
        op1 = Operator(self.rand_matrix(4, 4))
        op2 = Operator(op1)
        self.assertEqual(op1, op2)

    def test_circuit_init(self):
        """Test initialization from a circuit."""
        # Test tensor product of 1-qubit gates
        circuit = QuantumCircuit(3)
        circuit.h(0)
        circuit.x(1)
        circuit.ry(np.pi / 2, 2)
        op = Operator(circuit)
        y90 = (1 / np.sqrt(2)) * np.array([[1, -1], [1, 1]])
        target = np.kron(y90, np.kron(self.UX, self.UH))
        global_phase_equivalent = matrix_equal(
            op.data, target, ignore_phase=True)
        self.assertTrue(global_phase_equivalent)

        # Test decomposition of Controlled-u1 gate
        lam = np.pi / 4
        circuit = QuantumCircuit(2)
        circuit.cu1(lam, 0, 1)
        op = Operator(circuit)
        target = np.diag([1, 1, 1, np.exp(1j * lam)])
        global_phase_equivalent = matrix_equal(
            op.data, target, ignore_phase=True)
        self.assertTrue(global_phase_equivalent)

        # Test decomposition of controlled-H gate
        circuit = QuantumCircuit(2)
        circuit.ch(0, 1)
        op = Operator(circuit)
        target = np.kron(self.UI, np.diag([1, 0])) + np.kron(
            self.UH, np.diag([0, 1]))
        global_phase_equivalent = matrix_equal(
            op.data, target, ignore_phase=True)
        self.assertTrue(global_phase_equivalent)

    def test_instruction_init(self):
        """Test initialization from a circuit."""
        gate = CXGate()
        op = Operator(gate).data
        target = gate.to_matrix()
        global_phase_equivalent = matrix_equal(op, target, ignore_phase=True)
        self.assertTrue(global_phase_equivalent)

        gate = CHGate()
        op = Operator(gate).data
        had = HGate().to_matrix()
        target = np.kron(had, np.diag([0, 1])) + np.kron(
            np.eye(2), np.diag([1, 0]))
        global_phase_equivalent = matrix_equal(op, target, ignore_phase=True)
        self.assertTrue(global_phase_equivalent)

    def test_circuit_init_except(self):
        """Test initialization from circuit with measure raises exception."""
        circuit = self.simple_circuit_with_measure()
        self.assertRaises(QiskitError, Operator, circuit)

    def test_equal(self):
        """Test __eq__ method"""
        mat = self.rand_matrix(2, 2, real=True)
        self.assertEqual(Operator(np.array(mat, dtype=complex)),
                         Operator(mat))
        mat = self.rand_matrix(4, 4)
        self.assertEqual(Operator(mat.tolist()),
                         Operator(mat))

    def test_data(self):
        """Test Operator representation string property."""
        mat = self.rand_matrix(2, 2)
        op = Operator(mat)
        assert_allclose(mat, op.data)

    def test_dim(self):
        """Test Operator dim property."""
        mat = self.rand_matrix(4, 4)
        self.assertEqual(Operator(mat).dim, (4, 4))
        self.assertEqual(Operator(mat, input_dims=[4], output_dims=[4]).dim, (4, 4))
        self.assertEqual(Operator(mat, input_dims=[2, 2], output_dims=[2, 2]).dim, (4, 4))

    def test_input_dims(self):
        """Test Operator input_dims method."""
        op = Operator(self.rand_matrix(2 * 3 * 4, 4 * 5),
                      input_dims=[4, 5], output_dims=[2, 3, 4])
        self.assertEqual(op.input_dims(), (4, 5))
        self.assertEqual(op.input_dims(qargs=[0, 1]), (4, 5))
        self.assertEqual(op.input_dims(qargs=[1, 0]), (5, 4))
        self.assertEqual(op.input_dims(qargs=[0]), (4,))
        self.assertEqual(op.input_dims(qargs=[1]), (5,))

    def test_output_dims(self):
        """Test Operator output_dims method."""
        op = Operator(self.rand_matrix(2 * 3 * 4, 4 * 5),
                      input_dims=[4, 5], output_dims=[2, 3, 4])
        self.assertEqual(op.output_dims(), (2, 3, 4))
        self.assertEqual(op.output_dims(qargs=[0, 1, 2]), (2, 3, 4))
        self.assertEqual(op.output_dims(qargs=[2, 1, 0]), (4, 3, 2))
        self.assertEqual(op.output_dims(qargs=[2, 0, 1]), (4, 2, 3))
        self.assertEqual(op.output_dims(qargs=[0]), (2,))
        self.assertEqual(op.output_dims(qargs=[1]), (3,))
        self.assertEqual(op.output_dims(qargs=[2]), (4,))
        self.assertEqual(op.output_dims(qargs=[0, 2]), (2, 4))
        self.assertEqual(op.output_dims(qargs=[2, 0]), (4, 2))

    def test_reshape(self):
        """Test Operator reshape method."""
        op = Operator(self.rand_matrix(8, 8))
        reshaped1 = op.reshape(input_dims=[8], output_dims=[8])
        reshaped2 = op.reshape(input_dims=[4, 2], output_dims=[2, 4])
        self.assertEqual(op.output_dims(), (2, 2, 2))
        self.assertEqual(op.input_dims(), (2, 2, 2))
        self.assertEqual(reshaped1.output_dims(), (8,))
        self.assertEqual(reshaped1.input_dims(), (8,))
        self.assertEqual(reshaped2.output_dims(), (2, 4))
        self.assertEqual(reshaped2.input_dims(), (4, 2))

    def test_copy(self):
        """Test Operator copy method"""
        mat = np.eye(2)
        with self.subTest("Deep copy"):
            orig = Operator(mat)
            cpy = orig.copy()
            cpy._data[0, 0] = 0.0
            self.assertFalse(cpy == orig)
        with self.subTest("Shallow copy"):
            orig = Operator(mat)
            clone = copy.copy(orig)
            clone._data[0, 0] = 0.0
            self.assertTrue(clone == orig)

    def test_is_unitary(self):
        """Test is_unitary method."""
        # X-90 rotation
        X90 = la.expm(-1j * 0.5 * np.pi * np.array([[0, 1], [1, 0]]) / 2)
        self.assertTrue(Operator(X90).is_unitary())
        # Non-unitary should return false
        self.assertFalse(Operator([[1, 0], [0, 0]]).is_unitary())

    def test_to_operator(self):
        """Test to_operator method."""
        op1 = Operator(self.rand_matrix(4, 4))
        op2 = op1.to_operator()
        self.assertEqual(op1, op2)

    def test_conjugate(self):
        """Test conjugate method."""
        matr = self.rand_matrix(2, 4, real=True)
        mati = self.rand_matrix(2, 4, real=True)
        op = Operator(matr + 1j * mati)
        uni_conj = op.conjugate()
        self.assertEqual(uni_conj, Operator(matr - 1j * mati))

    def test_transpose(self):
        """Test transpose method."""
        matr = self.rand_matrix(2, 4, real=True)
        mati = self.rand_matrix(2, 4, real=True)
        op = Operator(matr + 1j * mati)
        uni_t = op.transpose()
        self.assertEqual(uni_t, Operator(matr.T + 1j * mati.T))

    def test_adjoint(self):
        """Test adjoint method."""
        matr = self.rand_matrix(2, 4, real=True)
        mati = self.rand_matrix(2, 4, real=True)
        op = Operator(matr + 1j * mati)
        uni_adj = op.adjoint()
        self.assertEqual(uni_adj, Operator(matr.T - 1j * mati.T))

    def test_compose_except(self):
        """Test compose different dimension exception"""
        self.assertRaises(QiskitError,
                          Operator(np.eye(2)).compose,
                          Operator(np.eye(3)))
        self.assertRaises(QiskitError, Operator(np.eye(2)).compose, 2)

    def test_compose(self):
        """Test compose method."""

        op1 = Operator(self.UX)
        op2 = Operator(self.UY)

        targ = Operator(np.dot(self.UY, self.UX))
        self.assertEqual(op1.compose(op2), targ)
        self.assertEqual(op1 @ op2, targ)

        targ = Operator(np.dot(self.UX, self.UY))
        self.assertEqual(op2.compose(op1), targ)
        self.assertEqual(op2 @ op1, targ)

    def test_dot(self):
        """Test dot method."""
        op1 = Operator(self.UY)
        op2 = Operator(self.UX)

        targ = Operator(np.dot(self.UY, self.UX))
        self.assertEqual(op1.dot(op2), targ)
        self.assertEqual(op1 * op2, targ)

        targ = Operator(np.dot(self.UX, self.UY))
        self.assertEqual(op2.dot(op1), targ)
        self.assertEqual(op2 * op1, targ)

    def test_compose_front(self):
        """Test front compose method."""

        opYX = Operator(self.UY).compose(Operator(self.UX), front=True)
        matYX = np.dot(self.UY, self.UX)
        self.assertEqual(opYX, Operator(matYX))

        opXY = Operator(self.UX).compose(Operator(self.UY), front=True)
        matXY = np.dot(self.UX, self.UY)
        self.assertEqual(opXY, Operator(matXY))

    def test_compose_subsystem(self):
        """Test subsystem compose method."""
        # 3-qubit operator
        mat = self.rand_matrix(8, 8)
        mat_a = self.rand_matrix(2, 2)
        mat_b = self.rand_matrix(2, 2)
        mat_c = self.rand_matrix(2, 2)
        op = Operator(mat)
        op1 = Operator(mat_a)
        op2 = Operator(np.kron(mat_b, mat_a))
        op3 = Operator(np.kron(mat_c, np.kron(mat_b, mat_a)))

        # op3 qargs=[0, 1, 2]
        targ = np.dot(np.kron(mat_c, np.kron(mat_b, mat_a)), mat)
        self.assertEqual(op.compose(op3, qargs=[0, 1, 2]), Operator(targ))
        self.assertEqual(op.compose(op3([0, 1, 2])), Operator(targ))
        self.assertEqual(op @ op3([0, 1, 2]), Operator(targ))
        # op3 qargs=[2, 1, 0]
        targ = np.dot(np.kron(mat_a, np.kron(mat_b, mat_c)), mat)
        self.assertEqual(op.compose(op3, qargs=[2, 1, 0]), Operator(targ))
        self.assertEqual(op @ op3([2, 1, 0]), Operator(targ))

        # op2 qargs=[0, 1]
        targ = np.dot(np.kron(np.eye(2), np.kron(mat_b, mat_a)), mat)
        self.assertEqual(op.compose(op2, qargs=[0, 1]), Operator(targ))
        self.assertEqual(op @ op2([0, 1]), Operator(targ))
        # op2 qargs=[2, 0]
        targ = np.dot(np.kron(mat_a, np.kron(np.eye(2), mat_b)), mat)
        self.assertEqual(op.compose(op2, qargs=[2, 0]), Operator(targ))
        self.assertEqual(op @ op2([2, 0]), Operator(targ))

        # op1 qargs=[0]
        targ = np.dot(np.kron(np.eye(4), mat_a), mat)
        self.assertEqual(op.compose(op1, qargs=[0]), Operator(targ))
        self.assertEqual(op @ op1([0]), Operator(targ))
        # op1 qargs=[1]
        targ = np.dot(np.kron(np.eye(2), np.kron(mat_a, np.eye(2))), mat)
        self.assertEqual(op.compose(op1, qargs=[1]), Operator(targ))
        self.assertEqual(op @ op1([1]), Operator(targ))
        # op1 qargs=[2]
        targ = np.dot(np.kron(mat_a, np.eye(4)), mat)
        self.assertEqual(op.compose(op1, qargs=[2]), Operator(targ))
        self.assertEqual(op @ op1([2]), Operator(targ))

    def test_dot_subsystem(self):
        """Test subsystem dot method."""
        # 3-qubit operator
        mat = self.rand_matrix(8, 8)
        mat_a = self.rand_matrix(2, 2)
        mat_b = self.rand_matrix(2, 2)
        mat_c = self.rand_matrix(2, 2)
        op = Operator(mat)
        op1 = Operator(mat_a)
        op2 = Operator(np.kron(mat_b, mat_a))
        op3 = Operator(np.kron(mat_c, np.kron(mat_b, mat_a)))

        # op3 qargs=[0, 1, 2]
        targ = np.dot(mat, np.kron(mat_c, np.kron(mat_b, mat_a)))
        self.assertEqual(op.dot(op3, qargs=[0, 1, 2]), Operator(targ))
        self.assertEqual(op * op3([0, 1, 2]), Operator(targ))
        # op3 qargs=[2, 1, 0]
        targ = np.dot(mat, np.kron(mat_a, np.kron(mat_b, mat_c)))
        self.assertEqual(op.dot(op3, qargs=[2, 1, 0]), Operator(targ))
        self.assertEqual(op * op3([2, 1, 0]), Operator(targ))

        # op2 qargs=[0, 1]
        targ = np.dot(mat, np.kron(np.eye(2), np.kron(mat_b, mat_a)))
        self.assertEqual(op.dot(op2, qargs=[0, 1]), Operator(targ))
        self.assertEqual(op * op2([0, 1]), Operator(targ))
        # op2 qargs=[2, 0]
        targ = np.dot(mat, np.kron(mat_a, np.kron(np.eye(2), mat_b)))
        self.assertEqual(op.dot(op2, qargs=[2, 0]), Operator(targ))
        self.assertEqual(op * op2([2, 0]), Operator(targ))

        # op1 qargs=[0]
        targ = np.dot(mat, np.kron(np.eye(4), mat_a))
        self.assertEqual(op.dot(op1, qargs=[0]), Operator(targ))
        self.assertEqual(op * op1([0]), Operator(targ))
        # op1 qargs=[1]
        targ = np.dot(mat, np.kron(np.eye(2), np.kron(mat_a, np.eye(2))))
        self.assertEqual(op.dot(op1, qargs=[1]), Operator(targ))
        self.assertEqual(op * op1([1]), Operator(targ))
        # op1 qargs=[2]
        targ = np.dot(mat, np.kron(mat_a, np.eye(4)))
        self.assertEqual(op.dot(op1, qargs=[2]), Operator(targ))
        self.assertEqual(op * op1([2]), Operator(targ))

    def test_compose_front_subsystem(self):
        """Test subsystem front compose method."""
        # 3-qubit operator
        mat = self.rand_matrix(8, 8)
        mat_a = self.rand_matrix(2, 2)
        mat_b = self.rand_matrix(2, 2)
        mat_c = self.rand_matrix(2, 2)
        op = Operator(mat)
        op1 = Operator(mat_a)
        op2 = Operator(np.kron(mat_b, mat_a))
        op3 = Operator(np.kron(mat_c, np.kron(mat_b, mat_a)))

        # op3 qargs=[0, 1, 2]
        targ = np.dot(mat, np.kron(mat_c, np.kron(mat_b, mat_a)))
        self.assertEqual(op.compose(op3, qargs=[0, 1, 2], front=True), Operator(targ))
        # op3 qargs=[2, 1, 0]
        targ = np.dot(mat, np.kron(mat_a, np.kron(mat_b, mat_c)))
        self.assertEqual(op.compose(op3, qargs=[2, 1, 0], front=True), Operator(targ))

        # op2 qargs=[0, 1]
        targ = np.dot(mat, np.kron(np.eye(2), np.kron(mat_b, mat_a)))
        self.assertEqual(op.compose(op2, qargs=[0, 1], front=True), Operator(targ))
        # op2 qargs=[2, 0]
        targ = np.dot(mat, np.kron(mat_a, np.kron(np.eye(2), mat_b)))
        self.assertEqual(op.compose(op2, qargs=[2, 0], front=True), Operator(targ))

        # op1 qargs=[0]
        targ = np.dot(mat, np.kron(np.eye(4), mat_a))
        self.assertEqual(op.compose(op1, qargs=[0], front=True), Operator(targ))

        # op1 qargs=[1]
        targ = np.dot(mat, np.kron(np.eye(2), np.kron(mat_a, np.eye(2))))
        self.assertEqual(op.compose(op1, qargs=[1], front=True), Operator(targ))

        # op1 qargs=[2]
        targ = np.dot(mat, np.kron(mat_a, np.eye(4)))
        self.assertEqual(op.compose(op1, qargs=[2], front=True), Operator(targ))

    def test_power(self):
        """Test power method."""
        X90 = la.expm(-1j * 0.5 * np.pi * np.array([[0, 1], [1, 0]]) / 2)
        op = Operator(X90)
        self.assertEqual(op.power(2), Operator([[0, -1j], [-1j, 0]]))
        self.assertEqual(op.power(4), Operator(-1 * np.eye(2)))
        self.assertEqual(op.power(8), Operator(np.eye(2)))

    def test_expand(self):
        """Test expand method."""
        mat1 = self.UX
        mat2 = np.eye(3, dtype=complex)

        mat21 = np.kron(mat2, mat1)
        op21 = Operator(mat1).expand(Operator(mat2))
        self.assertEqual(op21.dim, (6, 6))
        assert_allclose(op21.data, Operator(mat21).data)

        mat12 = np.kron(mat1, mat2)
        op12 = Operator(mat2).expand(Operator(mat1))
        self.assertEqual(op12.dim, (6, 6))
        assert_allclose(op12.data, Operator(mat12).data)

    def test_tensor(self):
        """Test tensor method."""
        mat1 = self.UX
        mat2 = np.eye(3, dtype=complex)

        mat21 = np.kron(mat2, mat1)
        op21 = Operator(mat2).tensor(Operator(mat1))
        self.assertEqual(op21.dim, (6, 6))
        assert_allclose(op21.data, Operator(mat21).data)

        mat12 = np.kron(mat1, mat2)
        op12 = Operator(mat1).tensor(Operator(mat2))
        self.assertEqual(op12.dim, (6, 6))
        assert_allclose(op12.data, Operator(mat12).data)

    def test_power_except(self):
        """Test power method raises exceptions."""
        op = Operator(self.rand_matrix(3, 3))
        # Non-integer power raises error
        self.assertRaises(QiskitError, op.power, 0.5)

    def test_add(self):
        """Test add method."""
        mat1 = self.rand_matrix(4, 4)
        mat2 = self.rand_matrix(4, 4)
        op1 = Operator(mat1)
        op2 = Operator(mat2)
        self.assertEqual(op1._add(op2), Operator(mat1 + mat2))
        self.assertEqual(op1 + op2, Operator(mat1 + mat2))
        self.assertEqual(op1 - op2, Operator(mat1 - mat2))

    def test_add_except(self):
        """Test add method raises exceptions."""
        op1 = Operator(self.rand_matrix(2, 2))
        op2 = Operator(self.rand_matrix(3, 3))
        self.assertRaises(QiskitError, op1._add, op2)

    def test_multiply(self):
        """Test multiply method."""
        mat = self.rand_matrix(4, 4)
        val = np.exp(5j)
        op = Operator(mat)
        self.assertEqual(op._multiply(val), Operator(val * mat))
        self.assertEqual(val * op, Operator(val * mat))

    def test_multiply_except(self):
        """Test multiply method raises exceptions."""
        op = Operator(self.rand_matrix(2, 2))
        self.assertRaises(QiskitError, op._multiply, 's')
        self.assertRaises(QiskitError, op.__rmul__, 's')
        self.assertRaises(QiskitError, op._multiply, op)
        self.assertRaises(QiskitError, op.__rmul__, op)

    def test_negate(self):
        """Test negate method"""
        mat = self.rand_matrix(4, 4)
        op = Operator(mat)
        self.assertEqual(-op, Operator(-1 * mat))

    def test_equiv(self):
        """Test negate method"""
        mat = np.diag([1, np.exp(1j * np.pi / 2)])
        phase = np.exp(-1j * np.pi / 4)
        op = Operator(mat)
        self.assertTrue(op.equiv(phase * mat))
        self.assertTrue(op.equiv(Operator(phase * mat)))
        self.assertFalse(op.equiv(2 * mat))


if __name__ == '__main__':
    unittest.main()

[(33, 'logging.getLogger', 'logging.getLogger', False, 'import logging\n'), (40, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (41, 'numpy.array', 'np.array', True, 'import numpy as np\n'), (42, 'numpy.array', 'np.array', True, 'import numpy as np\n'), (43, 'numpy.diag', 'np.diag', True, 'import numpy as np\n'), (569, 'unittest.main', 'unittest.main', False, 'import unittest\n'), (44, 'numpy.array', 'np.array', True, 'import numpy as np\n'), (44, 'numpy.sqrt', 'np.sqrt', True, 'import numpy as np\n'), (51, 'numpy.random.RandomState', 'np.random.RandomState', True, 'import numpy as np\n'), (55, 'numpy.trace', 'np.trace', True, 'import numpy as np\n'), (63, 'numpy.random.RandomState', 'np.random.RandomState', True, 'import numpy as np\n'), (73, 'qiskit.QuantumRegister', 'QuantumRegister', False, 'from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit\n'), (74, 'qiskit.QuantumCircuit', 'QuantumCircuit', False, 'from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit\n'), (84, 'qiskit.QuantumRegister', 'QuantumRegister', False, 'from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit\n'), (85, 'qiskit.ClassicalRegister', 'ClassicalRegister', False, 'from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit\n'), (86, 'qiskit.QuantumCircuit', 'QuantumCircuit', False, 'from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit\n'), (100, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (101, 'numpy.testing.assert_allclose', 'assert_allclose', False, 'from numpy.testing import assert_allclose\n'), (106, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (107, 'numpy.testing.assert_allclose', 'assert_allclose', False, 'from numpy.testing import assert_allclose\n'), (114, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (115, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (116, 'numpy.testing.assert_allclose', 'assert_allclose', False, 'from numpy.testing import assert_allclose\n'), (122, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (123, 'numpy.testing.assert_allclose', 'assert_allclose', False, 'from numpy.testing import assert_allclose\n'), (138, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (144, 'qiskit.QuantumCircuit', 'QuantumCircuit', False, 'from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit\n'), (148, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (151, 'qiskit.quantum_info.operators.predicates.matrix_equal', 'matrix_equal', False, 'from qiskit.quantum_info.operators.predicates import matrix_equal\n'), (157, 'qiskit.QuantumCircuit', 'QuantumCircuit', False, 'from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit\n'), (159, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (161, 'qiskit.quantum_info.operators.predicates.matrix_equal', 'matrix_equal', False, 'from qiskit.quantum_info.operators.predicates import matrix_equal\n'), (166, 'qiskit.QuantumCircuit', 'QuantumCircuit', False, 'from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit\n'), (168, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (171, 'qiskit.quantum_info.operators.predicates.matrix_equal', 'matrix_equal', False, 'from qiskit.quantum_info.operators.predicates import matrix_equal\n'), (177, 'qiskit.extensions.standard.CXGate', 'CXGate', False, 'from qiskit.extensions.standard import HGate, CHGate, CXGate\n'), (180, 'qiskit.quantum_info.operators.predicates.matrix_equal', 'matrix_equal', False, 'from qiskit.quantum_info.operators.predicates import matrix_equal\n'), (183, 'qiskit.extensions.standard.CHGate', 'CHGate', False, 'from qiskit.extensions.standard import HGate, CHGate, CXGate\n'), (188, 'qiskit.quantum_info.operators.predicates.matrix_equal', 'matrix_equal', False, 'from qiskit.quantum_info.operators.predicates import matrix_equal\n'), (208, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (209, 'numpy.testing.assert_allclose', 'assert_allclose', False, 'from numpy.testing import assert_allclose\n'), (256, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (286, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (294, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (302, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (316, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (317, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (329, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (330, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (344, 'numpy.dot', 'np.dot', True, 'import numpy as np\n'), (348, 'numpy.dot', 'np.dot', True, 'import numpy as np\n'), (358, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (359, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (402, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (403, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (445, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (446, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (479, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (487, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (489, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (494, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (502, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (504, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (509, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (524, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (525, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (539, 'numpy.exp', 'np.exp', True, 'import numpy as np\n'), (540, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (555, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (561, 'numpy.exp', 'np.exp', True, 'import numpy as np\n'), (562, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (78, 'numpy.array', 'np.array', True, 'import numpy as np\n'), (149, 'numpy.array', 'np.array', True, 'import numpy as np\n'), (150, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (178, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (184, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (200, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (203, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (258, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (263, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (264, 'copy.copy', 'copy.copy', False, 'import copy\n'), (288, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (296, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (304, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (319, 'numpy.dot', 'np.dot', True, 'import numpy as np\n'), (323, 'numpy.dot', 'np.dot', True, 'import numpy as np\n'), (332, 'numpy.dot', 'np.dot', True, 'import numpy as np\n'), (336, 'numpy.dot', 'np.dot', True, 'import numpy as np\n'), (343, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (345, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (347, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (349, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (360, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (365, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (366, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (367, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (370, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (371, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (375, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (376, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (379, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (380, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (384, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (385, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (388, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (389, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (392, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (393, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (404, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (409, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (410, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (413, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (414, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (418, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (419, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (422, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (423, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (427, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (428, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (431, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (432, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (435, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (436, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (447, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (452, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (455, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (459, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (462, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (466, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (470, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (474, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (480, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (490, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (495, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (505, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (510, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (526, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (527, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (528, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (541, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (542, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (556, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (49, 'numpy.iinfo', 'np.iinfo', True, 'import numpy as np\n'), (61, 'numpy.iinfo', 'np.iinfo', True, 'import numpy as np\n'), (78, 'numpy.sqrt', 'np.sqrt', True, 'import numpy as np\n'), (79, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (149, 'numpy.sqrt', 'np.sqrt', True, 'import numpy as np\n'), (160, 'numpy.exp', 'np.exp', True, 'import numpy as np\n'), (169, 'numpy.diag', 'np.diag', True, 'import numpy as np\n'), (170, 'numpy.diag', 'np.diag', True, 'import numpy as np\n'), (185, 'qiskit.extensions.standard.HGate', 'HGate', False, 'from qiskit.extensions.standard import HGate, CHGate, CXGate\n'), (186, 'numpy.diag', 'np.diag', True, 'import numpy as np\n'), (187, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (187, 'numpy.diag', 'np.diag', True, 'import numpy as np\n'), (199, 'numpy.array', 'np.array', True, 'import numpy as np\n'), (214, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (215, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (216, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (310, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (343, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (347, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (361, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (364, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (369, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (374, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (374, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (383, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (387, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (391, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (405, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (408, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (412, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (417, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (417, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (426, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (430, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (434, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (448, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (451, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (454, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (458, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (458, 'numpy.kron', 'np.kron', True, 'import numpy as np\n'), (465, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (469, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (473, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (482, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (490, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (492, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (495, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (497, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (505, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (507, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (510, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (512, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (560, 'numpy.exp', 'np.exp', True, 'import numpy as np\n'), (564, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (271, 'numpy.array', 'np.array', True, 'import numpy as np\n'), (272, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (274, 'qiskit.quantum_info.operators.operator.Operator', 'Operator', False, 'from qiskit.quantum_info.operators.operator import Operator\n'), (309, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (311, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (378, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (387, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (421, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (430, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (461, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (469, 'numpy.eye', 'np.eye', True, 'import numpy as np\n'), (478, 'numpy.array', 'np.array', True, 'import numpy as np\n'), (481, 'numpy.eye', 'np.eye', True, 'import numpy as np\n')]