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)
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)
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