




"""simple docstring"""


from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


A_      =    {
    '''configuration_blip''': [
        '''BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''BlipConfig''',
        '''BlipTextConfig''',
        '''BlipVisionConfig''',
    ],
    '''processing_blip''': ['''BlipProcessor'''],
}

try:
     if not is_vision_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     A_      =    ['''BlipImageProcessor''']


try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     A_      =    [
         '''BLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
         '''BlipModel''',
         '''BlipPreTrainedModel''',
         '''BlipForConditionalGeneration''',
         '''BlipForQuestionAnswering''',
         '''BlipVisionModel''',
         '''BlipTextModel''',
         '''BlipForImageTextRetrieval''',
     ]

try:
     if not is_tf_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     A_      =    [
         '''TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
         '''TFBlipModel''',
         '''TFBlipPreTrainedModel''',
         '''TFBlipForConditionalGeneration''',
         '''TFBlipForQuestionAnswering''',
         '''TFBlipVisionModel''',
         '''TFBlipTextModel''',
         '''TFBlipForImageTextRetrieval''',
     ]

if TYPE_CHECKING:
     from .configuration_blip import BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP, BlipConfig, BlipTextConfig, BlipVisionConfig
     from .processing_blip import BlipProcessor

     try:
          if not is_vision_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .image_processing_blip import BlipImageProcessor

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_blip import (
              BLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
              BlipForConditionalGeneration,
              BlipForImageTextRetrieval,
              BlipForQuestionAnswering,
              BlipModel,
              BlipPreTrainedModel,
              BlipTextModel,
              BlipVisionModel,
          )

     try:
          if not is_tf_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_tf_blip import (
              TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
              TFBlipForConditionalGeneration,
              TFBlipForImageTextRetrieval,
              TFBlipForQuestionAnswering,
              TFBlipModel,
              TFBlipPreTrainedModel,
              TFBlipTextModel,
              TFBlipVisionModel,
          )

else:
     import sys

     A_      =    _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)








"""simple docstring"""


import math

import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute


def  UpperCAmelCase__	(snake_case__							: int = 3   ):
  """simple docstring"""

  if isinstance(snake_case__		,       snake_case__   ):
    raise TypeError("""number of qubits must be a integer."""   )
  if number_of_qubits <= 0:
    raise ValueError("""number of qubits must be > 0."""   )
  if math.floor(snake_case__   ) != number_of_qubits:
    raise ValueError("""number of qubits must be exact integer."""   )
  if number_of_qubits > 10:
    raise ValueError("""number of qubits too large to simulate(>10)."""   )

  _snake_case							:		Optional[int]								=  QuantumRegister(snake_case__		,       """qr"""   )
  _snake_case							:		List[Any]								=  ClassicalRegister(snake_case__		,       """cr"""   )

  _snake_case							:		Optional[int]								=  QuantumCircuit(snake_case__		,       snake_case__   )

  _snake_case							:		Dict								=  number_of_qubits

  for i in range(snake_case__   ):
    quantum_circuit.h(number_of_qubits - i - 1   )
    counter -= 1
    for j in range(snake_case__   ):
      quantum_circuit.cp(np.pi / 2 ** (counter - j)		,       snake_case__		,       snake_case__   )

  for k in range(number_of_qubits // 2   ):
    quantum_circuit.swap(snake_case__		,       number_of_qubits - k - 1   )

  # measure all the qubits
  quantum_circuit.measure(snake_case__		,       snake_case__   )
  # simulate with 10000 shots
  _snake_case							:		Optional[int]								=  Aer.get_backend("""qasm_simulator"""   )
  _snake_case							:		Optional[int]								=  execute(snake_case__		,       snake_case__		,       shots=1_00_00   )

  return job.result().get_counts(snake_case__   )


if __name__ == "__main__":
     print(
         F'''Total count for quantum fourier transform state is: \
    {quantum_fourier_transform(3)}'''
     )


