




"""simple docstring"""





# Imports
import numpy as np



class      a__				:


			def __init__(      self      :    Optional[int]      ,  UpperCamelCase_      :    Tuple=None      ,  UpperCamelCase_      :    List[str]=None      ,  UpperCamelCase_      :    str=None      ,  UpperCamelCase_      :    List[str]=None      ,  UpperCamelCase_      :    List[Any]=None):


						"""simple docstring"""




						self.set_matricies(red=UpperCamelCase_      ,  green=UpperCamelCase_      ,  blue=UpperCamelCase_      ,  red_edge=UpperCamelCase_      ,  nir=UpperCamelCase_)


			def       a_     (      self      :    int      ,  UpperCamelCase_      :    Optional[Any]=None      ,  UpperCamelCase_      :    List[Any]=None      ,  UpperCamelCase_      :    Tuple=None      ,  UpperCamelCase_      :    Optional[int]=None      ,  UpperCamelCase_      :    Optional[Any]=None):


						"""simple docstring"""




						if red is not None:
									__UpperCAmelCase	: List[Any]		=					red
						if green is not None:
									__UpperCAmelCase	: List[Any]		=					green
						if blue is not None:
									__UpperCAmelCase	: Union[str, Any]		=					blue
						if red_edge is not None:
									__UpperCAmelCase	: Dict		=					red_edge
						if nir is not None:
									__UpperCAmelCase	: Optional[int]		=					nir
						return True


			def       a_     (      self      :    List[str]      ,  UpperCamelCase_      :    int=""      ,  UpperCamelCase_      :    str=None      ,  UpperCamelCase_      :    Union[str, Any]=None      ,  UpperCamelCase_      :    List[str]=None      ,  UpperCamelCase_      :    List[Any]=None      ,  UpperCamelCase_      :    List[Any]=None):


						"""simple docstring"""




						self.set_matricies(red=UpperCamelCase_      ,  green=UpperCamelCase_      ,  blue=UpperCamelCase_      ,  red_edge=UpperCamelCase_      ,  nir=UpperCamelCase_)
						__UpperCAmelCase	: str		=					{
						    "ARVI2": self.arvaa,
						    "CCCI": self.ccci,
						    "CVI": self.cvi,
						    "GLI": self.gli,
						    "NDVI": self.ndvi,
						    "BNDVI": self.bndvi,
						    "redEdgeNDVI": self.red_edge_ndvi,
						    "GNDVI": self.gndvi,
						    "GBNDVI": self.gbndvi,
						    "GRNDVI": self.grndvi,
						    "RBNDVI": self.rbndvi,
						    "PNDVI": self.pndvi,
						    "ATSAVI": self.atsavi,
						    "BWDRVI": self.bwdrvi,
						    "CIgreen": self.ci_green,
						    "CIrededge": self.ci_rededge,
						    "CI": self.ci,
						    "CTVI": self.ctvi,
						    "GDVI": self.gdvi,
						    "EVI": self.evi,
						    "GEMI": self.gemi,
						    "GOSAVI": self.gosavi,
						    "GSAVI": self.gsavi,
						    "Hue": self.hue,
						    "IVI": self.ivi,
						    "IPVI": self.ipvi,
						    "I": self.i,
						    "RVI": self.rvi,
						    "MRVI": self.mrvi,
						    "MSAVI": self.m_savi,
						    "NormG": self.norm_g,
						    "NormNIR": self.norm_nir,
						    "NormR": self.norm_r,
						    "NGRDI": self.ngrdi,
						    "RI": self.ri,
						    "S": self.s,
						    "IF": self._if,
						    "DVI": self.dvi,
						    "TVI": self.tvi,
						    "NDRE": self.ndre,
						}

						try:
									return funcs[index]()
						except KeyError:
									print("Index not in the list!")
									return False


			def       a_     (      self      :    List[str]):


						"""simple docstring"""




						return -0.18 + (1.17 * ((self.nir - self.red) / (self.nir + self.red)))


			def       a_     (      self      :    Any):


						"""simple docstring"""




						return ((self.nir - self.redEdge) / (self.nir + self.redEdge)) / (
						    (self.nir - self.red) / (self.nir + self.red)
						)


			def       a_     (      self      :    List[Any]):


						"""simple docstring"""




						return self.nir * (self.red / (self.green**2))


			def       a_     (      self      :    int):


						"""simple docstring"""




						return (2 * self.green - self.red - self.blue) / (
						    2 * self.green + self.red + self.blue
						)


			def       a_     (      self      :    Dict):


						"""simple docstring"""




						return (self.nir - self.red) / (self.nir + self.red)


			def       a_     (      self      :    Any):


						"""simple docstring"""




						return (self.nir - self.blue) / (self.nir + self.blue)


			def       a_     (      self      :    int):


						"""simple docstring"""




						return (self.redEdge - self.red) / (self.redEdge + self.red)


			def       a_     (      self      :    Optional[Any]):


						"""simple docstring"""




						return (self.nir - self.green) / (self.nir + self.green)


			def       a_     (      self      :    List[str]):


						"""simple docstring"""




						return (self.nir - (self.green + self.blue)) / (
						    self.nir + (self.green + self.blue)
						)


			def       a_     (      self      :    Any):


						"""simple docstring"""




						return (self.nir - (self.green + self.red)) / (
						    self.nir + (self.green + self.red)
						)


			def       a_     (      self      :    List[Any]):


						"""simple docstring"""




						return (self.nir - (self.blue + self.red)) / (self.nir + (self.blue + self.red))


			def       a_     (      self      :    List[str]):


						"""simple docstring"""




						return (self.nir - (self.green + self.red + self.blue)) / (
						    self.nir + (self.green + self.red + self.blue)
						)


			def       a_     (      self      :    Any      ,  UpperCamelCase_      :    List[str]=0.08      ,  UpperCamelCase_      :    List[str]=1.22      ,  UpperCamelCase_      :    Tuple=0.03):


						"""simple docstring"""




						return a * (
						    (self.nir - a * self.red - b)
						    / (a * self.nir + self.red - a * b + x * (1 + a**2))
						)


			def       a_     (      self      :    Optional[Any]):


						"""simple docstring"""




						return (0.1 * self.nir - self.blue) / (0.1 * self.nir + self.blue)


			def       a_     (      self      :    Any):


						"""simple docstring"""




						return (self.nir / self.green) - 1


			def       a_     (      self      :    str):


						"""simple docstring"""




						return (self.nir / self.redEdge) - 1


			def       a_     (      self      :    Tuple):


						"""simple docstring"""




						return (self.red - self.blue) / self.red


			def       a_     (      self      :    str):


						"""simple docstring"""




						__UpperCAmelCase	: Dict		=					self.ndvi()
						return ((ndvi + 0.5) / (abs(ndvi + 0.5))) * (abs(ndvi + 0.5) ** (1 / 2))


			def       a_     (      self      :    Dict):


						"""simple docstring"""




						return self.nir - self.green


			def       a_     (      self      :    int):


						"""simple docstring"""




						return 2.5 * (
						    (self.nir - self.red) / (self.nir + 6 * self.red - 7.5 * self.blue + 1)
						)


			def       a_     (      self      :    List[Any]):


						"""simple docstring"""




						__UpperCAmelCase	: List[str]		=					(2 * (self.nir**2 - self.red**2) + 1.5 * self.nir + 0.5 * self.red) / (
						    self.nir + self.red + 0.5
						)
						return n * (1 - 0.25 * n) - (self.red - 0.125) / (1 - self.red)


			def       a_     (      self      :    Dict      ,  UpperCamelCase_      :    List[str]=0.16):


						"""simple docstring"""




						return (self.nir - self.green) / (self.nir + self.green + y)


			def       a_     (      self      :    Optional[int]      ,  UpperCamelCase_      :    Tuple=0.5):


						"""simple docstring"""




						return ((self.nir - self.green) / (self.nir + self.green + n)) * (1 + n)


			def       a_     (      self      :    Optional[Any]):


						"""simple docstring"""




						return np.arctan(
						    ((2 * self.red - self.green - self.blue) / 30.5) * (self.green - self.blue))


			def       a_     (      self      :    Any      ,  UpperCamelCase_      :    Union[str, Any]=None      ,  UpperCamelCase_      :    int=None):


						"""simple docstring"""




						return (self.nir - b) / (a * self.red)


			def       a_     (      self      :    int):


						"""simple docstring"""




						return (self.nir / ((self.nir + self.red) / 2)) * (self.ndvi() + 1)


			def       a_     (      self      :    Tuple):


						"""simple docstring"""




						return (self.red + self.green + self.blue) / 30.5


			def       a_     (      self      :    List[Any]):


						"""simple docstring"""




						return self.nir / self.red


			def       a_     (      self      :    Tuple):


						"""simple docstring"""




						return (self.rvi() - 1) / (self.rvi() + 1)


			def       a_     (      self      :    str):


						"""simple docstring"""




						return (
						    (2 * self.nir + 1)
						    - ((2 * self.nir + 1) ** 2 - 8 * (self.nir - self.red)) ** (1 / 2)
						) / 2


			def       a_     (      self      :    Dict):


						"""simple docstring"""




						return self.green / (self.nir + self.red + self.green)


			def       a_     (      self      :    Optional[Any]):


						"""simple docstring"""




						return self.nir / (self.nir + self.red + self.green)


			def       a_     (      self      :    List[Any]):


						"""simple docstring"""




						return self.red / (self.nir + self.red + self.green)


			def       a_     (      self      :    Tuple):


						"""simple docstring"""




						return (self.green - self.red) / (self.green + self.red)


			def       a_     (      self      :    Optional[Any]):


						"""simple docstring"""




						return (self.red - self.green) / (self.red + self.green)


			def       a_     (      self      :    Tuple):


						"""simple docstring"""




						__UpperCAmelCase	: Any		=					np.max([np.max(self.red), np.max(self.green), np.max(self.blue)])
						__UpperCAmelCase	: Dict		=					np.min([np.min(self.red), np.min(self.green), np.min(self.blue)])
						return (max_value - min_value) / max_value


			def       a_     (      self      :    Union[str, Any]):


						"""simple docstring"""




						return (2 * self.red - self.green - self.blue) / (self.green - self.blue)


			def       a_     (      self      :    Tuple):


						"""simple docstring"""




						return self.nir / self.red


			def       a_     (      self      :    Any):


						"""simple docstring"""




						return (self.ndvi() + 0.5) ** (1 / 2)


			def       a_     (      self      :    Dict):


						"""simple docstring"""




						return (self.nir - self.redEdge) / (self.nir + self.redEdge)








"""simple docstring"""





def 					_UpperCamelCase    (			UpperCamelCase				,       UpperCamelCase = False							)			->			bool:


			"""simple docstring"""
			if n == 2:
						return True
			if not n % 2 or n < 2:
						return False
			if n > 5 and n % 10 not in (1, 3, 7, 9):  # can quickly check last digit
						return False
			if n > 3_3170_4406_4679_8873_8596_1981 and not allow_probable:
						raise ValueError(
						    "Warning: upper bound of deterministic test is exceeded. "
						    "Pass allow_probable=True to allow probabilistic test. "
						    "A return value of True indicates a probable prime."							)
			# array bounds provided by analysis
			__UpperCAmelCase	: List[str]		=					[
			    2047,
			    137_3653,
			    2532_6001,
			    32_1503_1751,
			    2_1523_0289_8747,
			    3_4747_4966_0383,
			    341_5500_7172_8321,
			    1,
			    382_5123_0565_4641_3051,
			    1,
			    1,
			    3186_6585_7834_0311_5116_7461,
			    3_3170_4406_4679_8873_8596_1981,
			]

			__UpperCAmelCase	: Tuple		=					[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41]
			for idx, _p in enumerate(UpperCamelCase				,       1							):
						if n < _p:
									# then we have our last prime to check
									__UpperCAmelCase	: Tuple		=					primes[:idx]
									break
			__UpperCAmelCase	,     __UpperCAmelCase	: List[str]		=					n - 1, 0
			# break up n -1 into a power of 2 (s) and
			# remaining odd component
			# essentially, solve for d * 2 ** s == n - 1
			while d % 2 == 0:
						d //= 2
						s += 1
			for prime in plist:
						__UpperCAmelCase	: Optional[int]		=					False
						for r in range(UpperCamelCase							):
									__UpperCAmelCase	: Dict		=					pow(UpperCamelCase				,       d * 2**r				,       UpperCamelCase							)
									# see article for analysis explanation for m
									if (r == 0 and m == 1) or ((m + 1) % n == 0):
												__UpperCAmelCase	: Optional[int]		=					True
												# this loop will not determine compositeness
												break
						if pr:
									continue
						# if pr is False, then the above loop never evaluated to true,
						# and the n MUST be composite
						return False
			return True

def 					_UpperCamelCase    (			)			->			None:


			"""simple docstring"""
			assert not miller_rabin(561							)
			assert miller_rabin(563							)
			# 2047

			assert not miller_rabin(83_8201							)
			assert miller_rabin(83_8207							)
			# 1_373_653

			assert not miller_rabin(1731_6001							)
			assert miller_rabin(1731_6017							)
			# 25_326_001

			assert not miller_rabin(30_7838_6641							)
			assert miller_rabin(30_7838_6653							)
			# 3_215_031_751

			assert not miller_rabin(1_7130_4557_4801							)
			assert miller_rabin(1_7130_4557_4819							)
			# 2_152_302_898_747

			assert not miller_rabin(2_7797_9972_8307							)
			assert miller_rabin(2_7797_9972_8327							)
			# 3_474_749_660_383

			assert not miller_rabin(113_8500_2390_9441							)
			assert miller_rabin(113_8500_2390_9527							)
			# 341_550_071_728_321

			assert not miller_rabin(127_5041_0188_4880_4351							)
			assert miller_rabin(127_5041_0188_4880_4391							)
			# 3_825_123_056_546_413_051

			assert not miller_rabin(796_6646_4458_5077_8779_1867							)
			assert miller_rabin(796_6646_4458_5077_8779_1951							)
			# 318_665_857_834_031_151_167_461

			assert not miller_rabin(5528_4067_7446_6478_9766_0333							)
			assert miller_rabin(5528_4067_7446_6478_9766_0359							)
			# 3_317_044_064_679_887_385_961_981
			# upper limit for probabilistic test


if __name__ == "__main__":
					test_miller_rabin()


