Beispiel #1
0
def create_eigs(matrix, num_auxiliary, num_time_slices, negative_evals):
    ne_qfts = [None, None]
    if negative_evals:
        num_auxiliary += 1
        ne_qfts = [QFT(num_auxiliary - 1), QFT(num_auxiliary - 1).inverse()]

    return EigsQPE(MatrixOperator(matrix=matrix),
                   QFT(num_auxiliary).inverse(),
                   num_time_slices=num_time_slices,
                   num_ancillae=num_auxiliary,
                   expansion_mode='suzuki',
                   expansion_order=2,
                   evo_time=None,  # This is t, can set to: np.pi*3/4
                   negative_evals=negative_evals,
                   ne_qfts=ne_qfts)
Beispiel #2
0
    def _create_eigs(matrix, num_ancillae, negative_evals):
        # Adding an additional flag qubit for negative eigenvalues
        ne_qfts = [None, None]
        if negative_evals:
            num_ancillae += 1
            ne_qfts = [StandardQFTS(num_ancillae - 1), StandardIQFTS(num_ancillae - 1)]

        return EigsQPE(MatrixOperator(matrix=matrix),
                       StandardIQFTS(num_ancillae),
                       num_time_slices=1,
                       num_ancillae=num_ancillae,
                       expansion_mode='suzuki',
                       expansion_order=2,
                       evo_time=None,
                       negative_evals=negative_evals,
                       ne_qfts=ne_qfts)
Beispiel #3
0
    def create_eigs(self, matrix, num_ancillae, num_time_slices,
                    negative_evals):
        ne_qfts = [None, None]
        if negative_evals:
            num_ancillae += 1
            ne_qfts = [QFT(num_ancillae - 1), QFT(num_ancillae - 1).inverse()]

        return EigsQPE(MatrixOperator(matrix=matrix),
                       QFT(num_ancillae).inverse(),
                       num_time_slices=num_time_slices,
                       num_ancillae=num_ancillae,
                       expansion_mode='suzuki',
                       expansion_order=2,
                       evo_time=np.pi * 3 / 4,
                       negative_evals=negative_evals,
                       ne_qfts=ne_qfts)
Beispiel #4
0
def create_eigs(matrix, num_ancillae, num_time_slices, negative_evals):
    ne_qfts = [None, None]
    if negative_evals:
        num_ancillae += 1
        ne_qfts = [QFT(num_ancillae - 1), QFT(num_ancillae - 1).inverse()]
    ret = EigsQPE(MatrixOperator(matrix=matrix),
                   QFT(num_ancillae).inverse(),
                   num_time_slices=num_time_slices,
                   num_ancillae=num_ancillae,
                   expansion_mode='suzuki',
                   expansion_order=2,
                   evo_time=None,  # This is t, can set to: np.pi*3/4
                   negative_evals=negative_evals,
                   ne_qfts=ne_qfts)
    #print(ret.construct_circuit(mode='circuit'))
    return ret
def create_eigs(matrix, num_ancillae, negative_evals):
    ne_qfts = [None, None]
    if negative_evals:
        num_ancillae += 1
        ne_qfts = [
            StandardQFTS(num_ancillae - 1),
            StandardIQFTS(num_ancillae - 1)
        ]

    return EigsQPE(MatrixOperator(matrix=matrix),
                   StandardIQFTS(num_ancillae),
                   num_time_slices=50,
                   num_ancillae=num_ancillae,
                   expansion_mode='suzuki',
                   expansion_order=2,
                   evo_time=None,
                   negative_evals=negative_evals,
                   ne_qfts=ne_qfts)
Beispiel #6
0
    def _create_eigs(matrix, num_ancillae, negative_evals):
        # Adding an additional flag qubit for negative eigenvalues
        ne_qfts = [None, None]
        if negative_evals:
            num_ancillae += 1
            ne_qfts = [QFT(num_ancillae - 1), QFT(num_ancillae - 1).inverse()]

        iqft = QFT(num_ancillae).inverse()

        eigs_qpe = EigsQPE(MatrixOperator(matrix=matrix),
                           iqft,
                           num_time_slices=1,
                           num_ancillae=num_ancillae,
                           expansion_mode='suzuki',
                           expansion_order=2,
                           evo_time=None,
                           negative_evals=negative_evals,
                           ne_qfts=ne_qfts)

        return eigs_qpe
Beispiel #7
0
    def _create_eigs(matrix,
                     num_ancillae,
                     negative_evals,
                     use_circuit_library=True):
        # Adding an additional flag qubit for negative eigenvalues
        ne_qfts = [None, None]
        if not use_circuit_library:
            warnings.filterwarnings('ignore', category=DeprecationWarning)

        if negative_evals:
            num_ancillae += 1
            if use_circuit_library:
                ne_qfts = [
                    QFT(num_ancillae - 1),
                    QFT(num_ancillae - 1).inverse()
                ]
            else:
                ne_qfts = [
                    StandardQFTS(num_ancillae - 1),
                    StandardIQFTS(num_ancillae - 1)
                ]

        if use_circuit_library:
            iqft = QFT(num_ancillae).inverse()
        else:
            iqft = StandardIQFTS(num_ancillae)

        eigs_qpe = EigsQPE(MatrixOperator(matrix=matrix),
                           iqft,
                           num_time_slices=1,
                           num_ancillae=num_ancillae,
                           expansion_mode='suzuki',
                           expansion_order=2,
                           evo_time=None,
                           negative_evals=negative_evals,
                           ne_qfts=ne_qfts)

        if not use_circuit_library:
            warnings.filterwarnings('always', category=DeprecationWarning)

        return eigs_qpe