

"""simple docstring"""




from __future__ import annotations

from typing import Any



def 						UpperCAmelCase__ (					*A__ )   ->   list[list[int]]:




   """simple docstring"""
   if all(_check_not_integer(A__ ) for m in matrix_s ):
      for i in matrix_s[1:]:
         _verify_matrix_sizes(matrix_s[0]						,     A__ )
      return [[sum(A__ ) for t in zip(*A__ )] for m in zip(*A__ )]
   raise TypeError("Expected a matrix, got int/list instead" )



def 						UpperCAmelCase__ (					A__						,     A__ )   ->   list[list[int]]:




   """simple docstring"""
   if (
       _check_not_integer(A__ )
       and _check_not_integer(A__ )
       and _verify_matrix_sizes(A__						,     A__ )
   ):
      return [[i - j for i, j in zip(*A__ )] for m in zip(A__						,     A__ )]
   raise TypeError("Expected a matrix, got int/list instead" )



def 						UpperCAmelCase__ (					A__						,     A__ )   ->   list[list[float]]:




   """simple docstring"""
   return [[x * n for x in row] for row in matrix]



def 						UpperCAmelCase__ (					A__						,     A__ )   ->   list[list[int]]:




   """simple docstring"""
   if _check_not_integer(A__ ) and _check_not_integer(A__ ):
      lowerCamelCase__       ,							lowerCamelCase__						       =      _verify_matrix_sizes(A__						,     A__ )

   if cols[0] != rows[1]:
      lowerCamelCase__						       =      (
          "Cannot multiply matrix of dimensions "
          f'({rows[0]},{cols[0]}) and ({rows[1]},{cols[1]})'
      )
      raise ValueError(A__ )
   return [
       [sum(m * n for m, n in zip(A__						,     A__ ) ) for j in zip(*A__ )] for i in matrix_a
   ]



def 						UpperCAmelCase__ (					A__ )   ->   list[list[int]]:




   """simple docstring"""
   lowerCamelCase__						       =      int(A__ )
   return [[int(row == column ) for column in range(A__ )] for row in range(A__ )]



def 						UpperCAmelCase__ (					A__						,     A__ = True )   ->   list[list[int]] | map[list[int]]:




   """simple docstring"""
   if _check_not_integer(A__ ):
      if return_map:
         return map(A__						,     zip(*A__ ) )
      else:
         return list(map(A__						,     zip(*A__ ) ) )
   raise TypeError("Expected a matrix, got int/list instead" )



def 						UpperCAmelCase__ (					A__						,     A__						,     A__ )   ->   list[list[int]]:




   """simple docstring"""
   lowerCamelCase__						       =      matrix[:row] + matrix[row + 1 :]
   return [row[:column] + row[column + 1 :] for row in minor]



def 						UpperCAmelCase__ (					A__ )   ->   Any:




   """simple docstring"""
   if len(A__ ) == 1:
      return matrix[0][0]

   return sum(
       x * determinant(minor(A__						,     0						,     A__ ) ) * (-1) ** i
       for i, x in enumerate(matrix[0] ) )



def 						UpperCAmelCase__ (					A__ )   ->   list[list[float]] | None:




   """simple docstring"""
   lowerCamelCase__						       =      determinant(A__ )
   if det == 0:
      return None

   lowerCamelCase__						       =      [
       [determinant(minor(A__						,     A__						,     A__ ) ) for j in range(len(A__ ) )]
       for i in range(len(A__ ) )
   ]

   lowerCamelCase__						       =      [
       [x * (-1) ** (row + col) for col, x in enumerate(matrix_minor[row] )]
       for row in range(len(A__ ) )
   ]
   lowerCamelCase__						       =      list(transpose(A__ ) )
   return scalar_multiply(A__						,     1 / det )



def 						UpperCAmelCase__ (					A__ )   ->   bool:




   """simple docstring"""
   return not isinstance(A__						,     A__ ) and not isinstance(matrix[0]						,     A__ )



def 						UpperCAmelCase__ (					A__ )   ->   tuple[int, int]:




   """simple docstring"""
   return len(A__ ), len(matrix[0] )



def 						UpperCAmelCase__ (					A__						,     A__ )   ->   tuple[tuple[int, int], tuple[int, int]]:




   """simple docstring"""
   lowerCamelCase__						       =      _shape(A__ ) + _shape(A__ )
   if shape[0] != shape[3] or shape[1] != shape[2]:
      lowerCamelCase__						       =      (
          "operands could not be broadcast together with shape "
          f'({shape[0], shape[1]}), ({shape[2], shape[3]})'
      )
      raise ValueError(A__ )
   return (shape[0], shape[2]), (shape[1], shape[3])



def 						UpperCAmelCase__ (					)   ->   None:




   """simple docstring"""
   lowerCamelCase__						       =      [[12, 10], [3, 9]]
   lowerCamelCase__						       =      [[3, 4], [7, 4]]
   lowerCamelCase__						       =      [[11, 12, 13, 14], [21, 22, 23, 24], [31, 32, 33, 34], [41, 42, 43, 44]]
   lowerCamelCase__						       =      [[3, 0, 2], [2, 0, -2], [0, 1, 1]]
   print(f'Add Operation, {add(A__						,     A__ ) = } \n' )
   print(
       f'Multiply Operation, {multiply(A__						,     A__ ) = } \n'						,     )
   print(f'Identity: {identity(5 )}\n' )
   print(f'Minor of {matrix_c} = {minor(A__						,     1						,     2 )} \n' )
   print(f'Determinant of {matrix_b} = {determinant(A__ )} \n' )
   print(f'Inverse of {matrix_d} = {inverse(A__ )}\n' )


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     main()







"""simple docstring"""




import math

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



def 						UpperCAmelCase__ (					A__ = 1						,     A__ = 1 )   ->   qiskit.result.counts.Counts:




   """simple docstring"""
   if isinstance(A__						,     A__ ) or isinstance(A__						,     A__ ):
      raise TypeError("inputs must be integers." )
   if (bit_a < 0) or (bit_a < 0):
      raise ValueError("inputs must be positive." )
   if (math.floor(A__ ) != bit_a) or (math.floor(A__ ) != 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
   lowerCamelCase__						       =      QuantumRegister(2						,     "qr" )
   lowerCamelCase__						       =      ClassicalRegister(2						,     "cr" )

   lowerCamelCase__						       =      QuantumCircuit(A__						,     A__ )

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

   # send the information
   lowerCamelCase__						       =      str(A__ ) + str(A__ )

   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(A__						,     A__ )

   lowerCamelCase__						       =      Aer.get_backend("aer_simulator" )
   lowerCamelCase__						       =      execute(A__						,     A__						,     shots=1000 )

   return job.result().get_counts(A__ )


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




