

from __future__ import annotations






class _UpperCamelCase				:
			'''simple docstring'''







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

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   Dict					  =							order

				# a_{0} ... a_{k}
				SCREAMING_SNAKE_CASE :   List[Any]					  =							[1.0] + [0.0] * order
				# b_{0} ... b_{k}
				SCREAMING_SNAKE_CASE :   List[str]					  =							[1.0] + [0.0] * order

				# x[n-1] ... x[n-k]
				SCREAMING_SNAKE_CASE :   Dict					  =							[0.0] * self.order
				# y[n-1] ... y[n-k]
				SCREAMING_SNAKE_CASE :   Tuple					  =							[0.0] * self.order
			def 				__UpperCamelCase			(      self				:			List[str]   ,   a				:			list[float]   ,   a				:			list[float]						)				->							None:

				"""simple docstring"""

				if len(a						) < self.order:
					SCREAMING_SNAKE_CASE :   int					  =							[1.0, *a_coeffs]

				if len(a						) != self.order + 1:
					SCREAMING_SNAKE_CASE :   List[Any]					  =							(
					    F"Expected a_coeffs to have {self.order + 1} elements "
					    F"for {self.order}-order filter, got {len(a						)}"
					)
					raise ValueError(a						)

				if len(a						) != self.order + 1:
					SCREAMING_SNAKE_CASE :   str					  =							(
					    F"Expected b_coeffs to have {self.order + 1} elements "
					    F"for {self.order}-order filter, got {len(a						)}"
					)
					raise ValueError(a						)

				SCREAMING_SNAKE_CASE :   Union[str, Any]					  =							a_coeffs
				SCREAMING_SNAKE_CASE :   List[Any]					  =							b_coeffs






			def 				__UpperCamelCase			(      self				:			Optional[int]   ,   a				:			float						)				->							float:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE :   int					  =							0.0

				# Start at index 1 and do index 0 at the end.
				for i in range(1   ,   self.order + 1						):
					result += (
					    self.b_coeffs[i] * self.input_history[i - 1]
					    - self.a_coeffs[i] * self.output_history[i - 1]
					)

				SCREAMING_SNAKE_CASE :   int					  =							(result + self.b_coeffs[0] * sample) / self.a_coeffs[0]

				SCREAMING_SNAKE_CASE :   List[Any]					  =							self.input_history[:-1]
				SCREAMING_SNAKE_CASE :   List[str]					  =							self.output_history[:-1]

				SCREAMING_SNAKE_CASE :   Any					  =							sample
				SCREAMING_SNAKE_CASE :   List[str]					  =							result

				return result



import qiskit
def 							__lowerCamelCase		(					UpperCAmelCase_		:						int					,    UpperCAmelCase_		:						int		):




      """simple docstring"""





      a		:Tuple									=			qiskit.Aer.get_backend('''aer_simulator'''		)

      # Create a Quantum Circuit acting on the q register
      a		:str									=			qiskit.QuantumCircuit(UpperCAmelCase_					,    UpperCAmelCase_		)

      # Apply X (NOT) Gate to Qubits 0 & 1
      circuit.x(0		)
      circuit.x(1		)

      # Map the quantum measurement to the classical bits
      circuit.measure([0, 1]					,    [0, 1]		)

      # Execute the circuit on the qasm simulator
      a		:Optional[Any]									=			qiskit.execute(UpperCAmelCase_					,    UpperCAmelCase_					,    shots=1000		)

      # Return the histogram data of the results of the experiment.
      return job.result().get_counts(UpperCAmelCase_		)


if __name__ == "__main__":
     snake_case							:       Any										=	single_qubit_measure(2, 2)
     print(F"""Total count for various states are: {counts}""")





