






"""simple docstring"""






import math

import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute




def 						_UpperCamelCase			(  A = 1    ,       A = 1			):
			if isinstance(snake_case_    ,       snake_case_			) or isinstance(snake_case_    ,       snake_case_			):
						raise TypeError("inputs must be integers."			)
			if (bit_a < 0) or (bit_a < 0):
						raise ValueError("inputs must be positive."			)
			if (math.floor(snake_case_			) != bit_a) or (math.floor(snake_case_			) != bit_a):
						raise ValueError("inputs must be exact integers."			)
			if (bit_a > 1) or (bit_a > 1):
						raise ValueError("inputs must be less or equal to 1."			)

			# build registers
			UpperCamelCase_     =QuantumRegister(2    ,       "qr"			)
			UpperCamelCase_     =ClassicalRegister(2    ,       "cr"			)

			UpperCamelCase_     =QuantumCircuit(snake_case_    ,       snake_case_			)

			# entanglement the qubits
			quantum_circuit.h(1			)
			quantum_circuit.cx(1    ,       0			)

			# send the information
			UpperCamelCase_     =str(snake_case_			) + str(snake_case_			)

			if c_information == "11":
						quantum_circuit.x(1			)
						quantum_circuit.z(1			)
			elif c_information == "10":
						quantum_circuit.z(1			)
			elif c_information == "01":
						quantum_circuit.x(1			)
			else:
						quantum_circuit.i(1			)

			# unentangled the circuit
			quantum_circuit.cx(1    ,       0			)
			quantum_circuit.h(1			)

			# measure the circuit
			quantum_circuit.measure(snake_case_    ,       snake_case_			)

			UpperCamelCase_     =Aer.get_backend("aer_simulator"			)
			UpperCamelCase_     =execute(snake_case_    ,       snake_case_    ,       shots=1_000			)

			return job.result().get_counts(snake_case_			)


if __name__ == "__main__":
				print(f'''Counts for classical state send: {superdense_coding(1,1)}''')








"""simple docstring"""






import unittest
from dataclasses import dataclass
from typing import List, Union

import numpy as np
import PIL.Image

from diffusers.utils.outputs import BaseOutput
@dataclass
class 						__lowerCAmelCase   (			UpperCAmelCase       ):







  '''simple docstring'''


  __lowerCamelCase       :    Union[List[PIL.Image.Image], np.ndarray]




class 						__lowerCAmelCase   (			unittest.TestCase       ):







  '''simple docstring'''


  def 					UpperCamelCase__   (      self:		Tuple					):
     UpperCamelCase_     =CustomOutput(images=np.random.rand(1				,			3				,			4				,			4					)					)

     # check every way of getting the attribute
     assert isinstance(outputs.images				,			np.ndarray					)
     assert outputs.images.shape == (1, 3, 4, 4)
     assert isinstance(outputs["images"]				,			np.ndarray					)
     assert outputs["images"].shape == (1, 3, 4, 4)
     assert isinstance(outputs[0]				,			np.ndarray					)
     assert outputs[0].shape == (1, 3, 4, 4)

     # test with a non-tensor attribute
     UpperCamelCase_     =CustomOutput(images=[PIL.Image.new("RGB"				,			(4, 4)					)]					)

     # check every way of getting the attribute
     assert isinstance(outputs.images				,			UpperCamelCase_					)
     assert isinstance(outputs.images[0]				,			PIL.Image.Image					)
     assert isinstance(outputs["images"]				,			UpperCamelCase_					)
     assert isinstance(outputs["images"][0]				,			PIL.Image.Image					)
     assert isinstance(outputs[0]				,			UpperCamelCase_					)
     assert isinstance(outputs[0][0]				,			PIL.Image.Image					)





  def 					UpperCamelCase__   (      self:		Optional[int]					):
     # test output reinitialization with a `dict` for compatibility with `accelerate`
     UpperCamelCase_     =CustomOutput({"images": np.random.rand(1				,			3				,			4				,			4					)}					)

     # check every way of getting the attribute
     assert isinstance(outputs.images				,			np.ndarray					)
     assert outputs.images.shape == (1, 3, 4, 4)
     assert isinstance(outputs["images"]				,			np.ndarray					)
     assert outputs["images"].shape == (1, 3, 4, 4)
     assert isinstance(outputs[0]				,			np.ndarray					)
     assert outputs[0].shape == (1, 3, 4, 4)

     # test with a non-tensor attribute
     UpperCamelCase_     =CustomOutput({"images": [PIL.Image.new("RGB"				,			(4, 4)					)]}					)

     # check every way of getting the attribute
     assert isinstance(outputs.images				,			UpperCamelCase_					)
     assert isinstance(outputs.images[0]				,			PIL.Image.Image					)
     assert isinstance(outputs["images"]				,			UpperCamelCase_					)
     assert isinstance(outputs["images"][0]				,			PIL.Image.Image					)
     assert isinstance(outputs[0]				,			UpperCamelCase_					)
     assert isinstance(outputs[0][0]				,			PIL.Image.Image					)
