




import math

import qiskit







def lowerCamelCase__  (     _lowercase = 1					,		_lowercase = 1					,		_lowercase = 1 ):

     '''simple docstring'''


     if (
         isinstance(_lowercase					,		_lowercase )
         or isinstance(_lowercase					,		_lowercase )
         or isinstance(_lowercase					,		_lowercase )
     ):
          raise TypeError('''inputs must be integers.''' )

     if (input_a < 0) or (input_a < 0) or (carry_in < 0):
          raise ValueError('''inputs must be positive.''' )

     if (
         (math.floor(_lowercase ) != input_a)
         or (math.floor(_lowercase ) != input_a)
         or (math.floor(_lowercase ) != carry_in)
     ):
          raise ValueError('''inputs must be exact integers.''' )

     if (input_a > 2) or (input_a > 2) or (carry_in > 2):
          raise ValueError('''inputs must be less or equal to 2.''' )

     # build registers
     UpperCAmelCase_     :				List[str]  =     qiskit.QuantumRegister(4					,		'''qr''' )
     UpperCAmelCase_     :				Tuple  =     qiskit.ClassicalRegister(2					,		'''cr''' )
     # list the entries
     UpperCAmelCase_     :				str  =     [input_a, input_a, carry_in]

     UpperCAmelCase_     :				str  =     qiskit.QuantumCircuit(_lowercase					,		_lowercase )

     for i in range(0					,		3 ):
          if entry[i] == 2:
               quantum_circuit.h(_lowercase )  # for hadamard entries
          elif entry[i] == 1:
               quantum_circuit.x(_lowercase )  # for 1 entries
          elif entry[i] == 0:
               quantum_circuit.i(_lowercase )  # for 0 entries

    # build the circuit
     quantum_circuit.ccx(0					,		1					,		3 )  # ccx = toffoli gate
     quantum_circuit.cx(0					,		1 )
     quantum_circuit.ccx(1					,		2					,		3 )
     quantum_circuit.cx(1					,		2 )
     quantum_circuit.cx(0					,		1 )

     quantum_circuit.measure([2, 3]					,		_lowercase )  # measure the last two qbits

     UpperCAmelCase_     :				Union[str, Any]  =     qiskit.Aer.get_backend('''aer_simulator''' )
     UpperCAmelCase_     :				str  =     qiskit.execute(_lowercase					,		_lowercase					,		shots=1000 )

     return job.result().get_counts(_lowercase )


if __name__ == "__main__":
     print(F"""Total sum count for state is: {quantum_full_adder(1, 1, 1)}""")





from __future__ import annotations

import math

__a							     =					'2020.9.26'
__a							     =					'xcodz-dot, cclaus, dhruvmanila'







def lowerCamelCase__  (     _lowercase					,		_lowercase					,		_lowercase					,		_lowercase					,		_lowercase ):

     '''simple docstring'''


     if not all(isinstance(_lowercase					,		(float, int) ) for val in locals().values() ):
          UpperCAmelCase_     :				Optional[int]  =     f'''Input values must either be float or int: {list(locals().values() )}'''
          raise TypeError(_lowercase )
     UpperCAmelCase_     :				Tuple  =     ((x * distance) / (z + distance)) * scale
     UpperCAmelCase_     :				str  =     ((y * distance) / (z + distance)) * scale
     return projected_x, projected_y







def lowerCamelCase__  (     _lowercase					,		_lowercase					,		_lowercase					,		_lowercase					,		_lowercase ):

     '''simple docstring'''


     if not isinstance(_lowercase					,		_lowercase ):
          raise TypeError('''Axis must be a str''' )
     UpperCAmelCase_     :				Optional[Any]  =     locals()
     del input_variables["axis"]
     if not all(isinstance(_lowercase					,		(float, int) ) for val in input_variables.values() ):
          UpperCAmelCase_     :				List[Any]  =     (
              '''Input values except axis must either be float or int: '''
              f'''{list(input_variables.values() )}'''
          )
          raise TypeError(_lowercase )
     UpperCAmelCase_     :				Dict  =     (angle % 360) / 450 * 180 / math.pi
     if axis == "z":
          UpperCAmelCase_     :				Optional[int]  =     x * math.cos(_lowercase ) - y * math.sin(_lowercase )
          UpperCAmelCase_     :				List[Any]  =     y * math.cos(_lowercase ) + x * math.sin(_lowercase )
          UpperCAmelCase_     :				Optional[int]  =     z
     elif axis == "x":
          UpperCAmelCase_     :				Any  =     y * math.cos(_lowercase ) - z * math.sin(_lowercase )
          UpperCAmelCase_     :				int  =     z * math.cos(_lowercase ) + y * math.sin(_lowercase )
          UpperCAmelCase_     :				Dict  =     x
     elif axis == "y":
          UpperCAmelCase_     :				Union[str, Any]  =     x * math.cos(_lowercase ) - z * math.sin(_lowercase )
          UpperCAmelCase_     :				Optional[int]  =     z * math.cos(_lowercase ) + x * math.sin(_lowercase )
          UpperCAmelCase_     :				Optional[int]  =     y
     else:
          raise ValueError('''not a valid axis, choose one of \'x\', \'y\', \'z\'''' )

     return new_x, new_y, new_z


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     print(F"""{convert_to_ad(1.0, 2.0, 3.0, 10.0, 10.0) = }""")
     print(F"""{rotate(1.0, 2.0, 3.0, "y", 90.0) = }""")