

'''simple docstring'''


from math import atan, cos, radians, sin, tan

from .haversine_distance import haversine_distance

lowerCAmelCase__						:       int										=						6378137.0
lowerCAmelCase__						:       Optional[int]										=						6356752.314245
lowerCAmelCase__						:       List[Any]										=						6378137




def 	_a       (				__lowerCAmelCase		:      float   ,							__lowerCAmelCase		:      float   ,							__lowerCAmelCase		:      float   ,							__lowerCAmelCase		:      float     ):

		"""simple docstring"""

		snake_case__						:       Optional[Any]       						=  (AXIS_A - AXIS_B) / AXIS_A
		# Parametric latitudes
		# https://en.wikipedia.org/wiki/Latitude#Parametric_(or_reduced)_latitude
		snake_case__						:       Tuple       						=  atan((1 - flattening) * tan(radians(__lowerCAmelCase     )     )     )
		snake_case__						:       Optional[Any]       						=  atan((1 - flattening) * tan(radians(__lowerCAmelCase     )     )     )

		# Compute central angle between two points
		# using haversine theta. sigma =  haversine_distance / equatorial radius
		snake_case__						:       int       						=  haversine_distance(__lowerCAmelCase   ,							__lowerCAmelCase   ,							__lowerCAmelCase   ,							__lowerCAmelCase     ) / EQUATORIAL_RADIUS

		# Intermediate P and Q values
		snake_case__						:       Any       						=  (b_lata + b_lata) / 2
		snake_case__						:       Optional[Any]       						=  (b_lata - b_lata) / 2

		# Intermediate X value
		# X = (sigma - sin(sigma)) * sin^2Pcos^2Q / cos^2(sigma/2)
		snake_case__						:       str       						=  (sin(__lowerCAmelCase     ) ** 2) * (cos(__lowerCAmelCase     ) ** 2)
		snake_case__						:       Tuple       						=  cos(sigma / 2     ) ** 2
		snake_case__						:       List[Any]       						=  (sigma - sin(__lowerCAmelCase     )) * (x_numerator / x_demonimator)

		# Intermediate Y value
		# Y = (sigma + sin(sigma)) * cos^2Psin^2Q / sin^2(sigma/2)
		snake_case__						:       int       						=  (cos(__lowerCAmelCase     ) ** 2) * (sin(__lowerCAmelCase     ) ** 2)
		snake_case__						:       List[str]       						=  sin(sigma / 2     ) ** 2
		snake_case__						:       Tuple       						=  (sigma + sin(__lowerCAmelCase     )) * (y_numerator / y_denominator)

		return EQUATORIAL_RADIUS * (sigma - ((flattening / 2) * (x_value + y_value)))


if __name__ == "__main__":
					import doctest

					doctest.testmod()






'''simple docstring'''


import unittest

from diffusers import FlaxAutoencoderKL
from diffusers.utils import is_flax_available
from diffusers.utils.testing_utils import require_flax

from .test_modeling_common_flax import FlaxModelTesterMixin


if is_flax_available():
					import jax




@require_flax
class     a			(				SCREAMING_SNAKE_CASE			,			unittest.TestCase       ):






						"""simple docstring"""




						__UpperCAmelCase			     =    FlaxAutoencoderKL







						@property
						def       __magic_name__							(							self					:      str  ):



								'''simple docstring'''



								snake_case__						:       Any       						=  4
								snake_case__						:       Optional[Any]       						=  3
								snake_case__						:       Optional[int]       						=  (3_2, 3_2)

								snake_case__						:       Optional[int]       						=  jax.random.PRNGKey(0  )
								snake_case__						:       Union[str, Any]       						=  jax.random.uniform(snake_case_			,			((batch_size, num_channels) + sizes)  )

								return {"sample": image, "prng_key": prng_key}







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



								'''simple docstring'''



								snake_case__						:       Any       						=  {
								    '''block_out_channels''': [3_2, 6_4],
								    '''in_channels''': 3,
								    '''out_channels''': 3,
								    '''down_block_types''': ['''DownEncoderBlock2D''', '''DownEncoderBlock2D'''],
								    '''up_block_types''': ['''UpDecoderBlock2D''', '''UpDecoderBlock2D'''],
								    '''latent_channels''': 4,
								}
								snake_case__						:       Dict       						=  self.dummy_input
								return init_dict, inputs_dict



