




'''simple docstring'''





import os

from ...utils import logging
from .utils import DataProcessor, InputExample


_SCREAMING_SNAKE_CASE							:     List[str]   	=				logging.get_logger(__name__)




class 				_snake_case	(			lowercase_							):




			def __init__(      self       ,							a__       ,							a__=None							)       ->       Optional[int]:

										'''simple docstring'''




										snake_case_			      =   language
										snake_case_			      =   train_language




			def      lowerCAmelCase__       (      self       ,							a__							)       ->       List[str]:

										'''simple docstring'''




										snake_case_			      =   self.language if self.train_language is None else self.train_language
										snake_case_			      =   self._read_tsv(os.path.join(a__       ,							F'XNLI-MT-1.0/multinli/multinli.train.{lg}.tsv'							)							)
										snake_case_			      =   []
										for i, line in enumerate(a__							):
																	if i == 0:
																								continue
																	snake_case_			      =   F'train-{i}'
																	snake_case_			      =   line[0]
																	snake_case_			      =   line[1]
																	snake_case_			      =   "contradiction" if line[2] == "contradictory" else line[2]
																	if not isinstance(a__       ,							a__							):
																								raise ValueError(F'Training input {text_a} is not a string'							)
																	if not isinstance(a__       ,							a__							):
																								raise ValueError(F'Training input {text_b} is not a string'							)
																	if not isinstance(a__       ,							a__							):
																								raise ValueError(F'Training label {label} is not a string'							)
																	examples.append(InputExample(guid=a__       ,							text_a=a__       ,							text_b=a__       ,							label=a__							)							)
										return examples




			def      lowerCAmelCase__       (      self       ,							a__							)       ->       List[str]:

										'''simple docstring'''




										snake_case_			      =   self._read_tsv(os.path.join(a__       ,							"XNLI-1.0/xnli.test.tsv"							)							)
										snake_case_			      =   []
										for i, line in enumerate(a__							):
																	if i == 0:
																								continue
																	snake_case_			      =   line[0]
																	if language != self.language:
																								continue
																	snake_case_			      =   F'test-{i}'
																	snake_case_			      =   line[6]
																	snake_case_			      =   line[7]
																	snake_case_			      =   line[1]
																	if not isinstance(a__       ,							a__							):
																								raise ValueError(F'Training input {text_a} is not a string'							)
																	if not isinstance(a__       ,							a__							):
																								raise ValueError(F'Training input {text_b} is not a string'							)
																	if not isinstance(a__       ,							a__							):
																								raise ValueError(F'Training label {label} is not a string'							)
																	examples.append(InputExample(guid=a__       ,							text_a=a__       ,							text_b=a__       ,							label=a__							)							)
										return examples




			def      lowerCAmelCase__       (      self							)       ->       Optional[Any]:

										'''simple docstring'''




										return ["contradiction", "entailment", "neutral"]

_SCREAMING_SNAKE_CASE							:     Tuple   	=				{
    "xnli": XnliProcessor,
}

_SCREAMING_SNAKE_CASE							:     Optional[Any]   	=				{
    "xnli": "classification",
}

_SCREAMING_SNAKE_CASE							:     Union[str, Any]   	=				{
    "xnli": 3,
}










'''simple docstring'''





import qiskit
from qiskit.providers import Backend


def   UpperCamelCase_(			snake_case							: int							,       snake_case							: int  ):

							'''simple docstring'''






							snake_case_      ,   snake_case_			      =   bin(snake_case  )[2:], bin(snake_case  )[2:]  # Remove leading '0b'

							# Ensure that both strings are of the same length
							if len(snake_case  ) > len(snake_case  ):
														snake_case_			      =   y.zfill(len(snake_case  )  )
							else:
														snake_case_			      =   x.zfill(len(snake_case  )  )

							# We need (3 * number of bits in the larger number)+1 qBits
							# The second parameter is the number of classical registers, to measure the result
							snake_case_			      =   qiskit.QuantumCircuit((len(snake_case  ) * 3) + 1							,       len(snake_case  ) + 1  )

							# We are essentially "not-ing" the bits that are 1
							# Reversed because it's easier to perform ops on more significant bits
							for i in range(len(snake_case  )  ):
														if x[::-1][i] == "1":
																					circuit.x(snake_case  )
							for j in range(len(snake_case  )  ):
														if y[::-1][j] == "1":
																					circuit.x(len(snake_case  ) + j  )

							return circuit, x, y


def   UpperCamelCase_(			snake_case							: qiskit.QuantumCircuit							,       snake_case							: int							,       snake_case							: int							,       snake_case							: int							,       snake_case							: int							,       ):

							'''simple docstring'''






							circuit.ccx(snake_case							,       snake_case							,       snake_case  )
							circuit.cx(snake_case							,       snake_case  )
							circuit.ccx(snake_case							,       snake_case							,       snake_case  )
							circuit.cx(snake_case							,       snake_case  )
							circuit.cx(snake_case							,       snake_case  )


def   UpperCamelCase_(			snake_case							: int							,       snake_case							: int							,       snake_case							: Backend = qiskit.Aer.get_backend("aer_simulator"  )							,       ):

							'''simple docstring'''






							if vala < 0 or vala < 0:
														raise ValueError("Both Integers must be positive!"  )

							# Store the Integers
							snake_case_      ,   snake_case_      ,   snake_case_			      =   store_two_classics(snake_case							,       snake_case  )
							for i in range(len(snake_case  )  ):
														full_adder(snake_case							,       snake_case							,       len(snake_case  ) + i							,       len(snake_case  ) + len(snake_case  ) + i							,       len(snake_case  ) + len(snake_case  ) + i + 1  )
														circuit.barrier()  # Optional, just for aesthetics

							# Measure the resultant qBits
							for i in range(len(snake_case  ) + 1  ):
														circuit.measure([(len(snake_case  ) * 2) + i]							,       [i]  )

							snake_case_			      =   qiskit.execute(snake_case							,       snake_case							,       shots=1  ).result()

							# The result is in binary. Convert it back to int
							return int(list(res.get_counts()  )[0]							,       2  )


if __name__ == "__main__":
		import doctest

		doctest.testmod()




