
import math

import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute






def 		_UpperCAmelCase   (	UpperCamelCase:     int = 3  ):






	"""simple docstring"""


	if isinstance(UpperCamelCase			,							UpperCamelCase  ):
		raise TypeError("number of qubits must be a integer."  )
	if number_of_qubits <= 0:
		raise ValueError("number of qubits must be > 0."  )
	if math.floor(UpperCamelCase  ) != number_of_qubits:
		raise ValueError("number of qubits must be exact integer."  )
	if number_of_qubits > 1_0:
		raise ValueError("number of qubits too large to simulate(>10)."  )

	__lowerCAmelCase         =							QuantumRegister(UpperCamelCase			,							"qr"  )
	__lowerCAmelCase         =							ClassicalRegister(UpperCamelCase			,							"cr"  )

	__lowerCAmelCase         =							QuantumCircuit(UpperCamelCase			,							UpperCamelCase  )

	__lowerCAmelCase         =							number_of_qubits

	for i in range(UpperCamelCase  ):
		quantum_circuit.h(number_of_qubits - i - 1  )
		counter -= 1
		for j in range(UpperCamelCase  ):
			quantum_circuit.cp(np.pi / 2 ** (counter - j)			,							UpperCamelCase			,							UpperCamelCase  )

	for k in range(number_of_qubits // 2  ):
		quantum_circuit.swap(UpperCamelCase			,							number_of_qubits - k - 1  )

	# measure all the qubits
	quantum_circuit.measure(UpperCamelCase			,							UpperCamelCase  )
	# simulate with 10000 shots
	__lowerCAmelCase         =							Aer.get_backend("qasm_simulator"  )
	__lowerCAmelCase         =							execute(UpperCamelCase			,							UpperCamelCase			,							shots=1_0_0_0_0  )

	return job.result().get_counts(UpperCamelCase  )


if __name__ == "__main__":
					print(
					    f'''Total count for quantum fourier transform state is: \
    {quantum_fourier_transform(3)}'''
					)


import fire

from utils import calculate_rouge, save_json






def 		_UpperCAmelCase   (	UpperCamelCase:     Any			,							UpperCamelCase:     Union[str, Any]			,							UpperCamelCase:     List[Any]=None			,							**UpperCamelCase:     Optional[int]  ):






	"""simple docstring"""


	__lowerCAmelCase         =							[x.strip() for x in open(UpperCamelCase  ).readlines()]
	__lowerCAmelCase         =							[x.strip() for x in open(UpperCamelCase  ).readlines()][: len(UpperCamelCase  )]
	__lowerCAmelCase         =							calculate_rouge(UpperCamelCase			,							UpperCamelCase			,							**UpperCamelCase  )
	if save_path is not None:
		save_json(UpperCamelCase			,							UpperCamelCase			,							indent=UpperCamelCase  )
	return metrics  # these print nicely


if __name__ == "__main__":
					fire.Fire(calculate_rouge_path)






