




import warnings
from collections.abc import Callable
from typing import Any

import numpy
from matplotlib import pyplot

__SCREAMING_SNAKE_CASE      :				Any				      =0.25 + 0.0J
__SCREAMING_SNAKE_CASE      :				List[Any]				      =-0.4 + 0.6J
__SCREAMING_SNAKE_CASE      :				Dict				      =-0.1 + 0.6_5_1J
__SCREAMING_SNAKE_CASE      :				Union[str, Any]				      =-2.0
__SCREAMING_SNAKE_CASE      :				str				      =56
__SCREAMING_SNAKE_CASE      :				Optional[int]				      =2.0
__SCREAMING_SNAKE_CASE      :				Optional[Any]				      =666

def      lowerCAmelCase_     (					lowerCamelCase:    complex       ,			lowerCamelCase:    numpy.ndarray  )   ->     numpy.ndarray:


      '''simple docstring'''




      return numpy.exp(lowerCamelCase  ) + c_parameter

def      lowerCAmelCase_     (					lowerCamelCase:    complex       ,			lowerCamelCase:    numpy.ndarray  )   ->     numpy.ndarray:


      '''simple docstring'''




      return z_values * z_values + c_parameter

def      lowerCAmelCase_     (					lowerCamelCase:    float       ,			lowerCamelCase:    int  )   ->     numpy.ndarray:


      '''simple docstring'''




      lowerCamelCase__ 					=			numpy.linspace(-window_size       ,			lowerCamelCase       ,			lowerCamelCase  )
      lowerCamelCase__ 					=			x.reshape((nb_pixels, 1)  )
      lowerCamelCase__ 					=			numpy.linspace(-window_size       ,			lowerCamelCase       ,			lowerCamelCase  )
      lowerCamelCase__ 					=			y.reshape((1, nb_pixels)  )
      return x + 1.0j * y

def      lowerCAmelCase_     (					lowerCamelCase:    Callable[[Any, numpy.ndarray], numpy.ndarray]       ,			lowerCamelCase:    Any       ,			lowerCamelCase:    int       ,			lowerCamelCase:    numpy.ndarray       ,			lowerCamelCase:    float | None = None       ,			)   ->     numpy.ndarray:


      '''simple docstring'''




      lowerCamelCase__ 					=			z_a.astype('complex64'  )
      for _ in range(lowerCamelCase  ):
            lowerCamelCase__ 					=			eval_function(lowerCamelCase       ,			lowerCamelCase  )
            if infinity is not None:
                  numpy.nan_to_num(lowerCamelCase       ,			copy=lowerCamelCase       ,			nan=lowerCamelCase  )
                  lowerCamelCase__ 					=			infinity
      return z_n

def      lowerCAmelCase_     (					lowerCamelCase:    str       ,			lowerCamelCase:    Any       ,			lowerCamelCase:    float       ,			lowerCamelCase:    numpy.ndarray       ,			)   ->     None:


      '''simple docstring'''




      lowerCamelCase__ 					=			(abs(lowerCamelCase  )).transpose()
      lowerCamelCase__ 					=			abs_z_final[::-1, :]
      pyplot.matshow(abs_z_final < escape_radius  )
      pyplot.title(f"""Julia set of ${function_label}$, $c={function_params}$"""  )
      pyplot.show()

def      lowerCAmelCase_     (					)   ->     None:


      '''simple docstring'''




      warnings.filterwarnings(
          'ignore'       ,			category=lowerCamelCase       ,			message='overflow encountered in multiply'  )
      warnings.filterwarnings(
          'ignore'       ,			category=lowerCamelCase       ,			message='invalid value encountered in multiply'       ,			)
      warnings.filterwarnings(
          'ignore'       ,			category=lowerCamelCase       ,			message='overflow encountered in absolute'  )
      warnings.filterwarnings(
          'ignore'       ,			category=lowerCamelCase       ,			message='overflow encountered in exp'  )


if __name__ == "__main__":
      __SCREAMING_SNAKE_CASE      :				Optional[Any]				      =prepare_grid(window_size, nb_pixels)

      ignore_overflow_warnings()  # See file header for explanations

      __SCREAMING_SNAKE_CASE      :				List[str]				      =24
      __SCREAMING_SNAKE_CASE      :				Union[str, Any]				      =2 * abs(c_cauliflower) + 1
      __SCREAMING_SNAKE_CASE      :				Optional[Any]				      =iterate_function(
          eval_quadratic_polynomial,
          c_cauliflower,
          nb_iterations,
          z_a,
          infinity=1.1 * escape_radius,
      )
      show_results("""z^2+c""", c_cauliflower, escape_radius, z_final)

      __SCREAMING_SNAKE_CASE      :				Tuple				      =64
      __SCREAMING_SNAKE_CASE      :				Union[str, Any]				      =2 * abs(c_polynomial_a) + 1
      __SCREAMING_SNAKE_CASE      :				List[Any]				      =iterate_function(
          eval_quadratic_polynomial,
          c_polynomial_a,
          nb_iterations,
          z_a,
          infinity=1.1 * escape_radius,
      )
      show_results("""z^2+c""", c_polynomial_a, escape_radius, z_final)

      __SCREAMING_SNAKE_CASE      :				Any				      =161
      __SCREAMING_SNAKE_CASE      :				Optional[int]				      =2 * abs(c_polynomial_a) + 1
      __SCREAMING_SNAKE_CASE      :				Optional[int]				      =iterate_function(
          eval_quadratic_polynomial,
          c_polynomial_a,
          nb_iterations,
          z_a,
          infinity=1.1 * escape_radius,
      )
      show_results("""z^2+c""", c_polynomial_a, escape_radius, z_final)

      __SCREAMING_SNAKE_CASE      :				Tuple				      =12
      __SCREAMING_SNAKE_CASE      :				int				      =1_0000.0
      __SCREAMING_SNAKE_CASE      :				Optional[Any]				      =iterate_function(
          eval_exponential,
          c_exponential,
          nb_iterations,
          z_a + 2,
          infinity=1.0e1_0,
      )
      show_results("""e^z+c""", c_exponential, escape_radius, z_final)





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__SCREAMING_SNAKE_CASE      :				int				      ={"""configuration_nat""": ["""NAT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NatConfig"""]}


try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __SCREAMING_SNAKE_CASE      :				Optional[int]				      =[
          """NAT_PRETRAINED_MODEL_ARCHIVE_LIST""",
          """NatForImageClassification""",
          """NatModel""",
          """NatPreTrainedModel""",
          """NatBackbone""",
      ]

if TYPE_CHECKING:
      from .configuration_nat import NAT_PRETRAINED_CONFIG_ARCHIVE_MAP, NatConfig

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_nat import (
                NAT_PRETRAINED_MODEL_ARCHIVE_LIST,
                NatBackbone,
                NatForImageClassification,
                NatModel,
                NatPreTrainedModel,
            )

else:
      import sys

      __SCREAMING_SNAKE_CASE      :				Any				      =_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)