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

from .haversine_distance import haversine_distance

_A  =	6_378_137.0
_A  =	6_356_752.314_245
_A  =	6_37_81_37






def   lowerCamelCase__							(							__lowerCAmelCase    :    float       ,				__lowerCAmelCase    :    float       ,				__lowerCAmelCase    :    float       ,				__lowerCAmelCase    :    float							):




			"""simple docstring"""


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

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

			# Intermediate P and Q values
			lowerCAmelCase_         =      (b_lata + b_lata) / 2
			lowerCAmelCase_         =      (b_lata - b_lata) / 2

			# Intermediate X value
			# X = (sigma - sin(sigma)) * sin^2Pcos^2Q / cos^2(sigma/2)
			lowerCAmelCase_         =      (sin(__lowerCAmelCase							) ** 2) * (cos(__lowerCAmelCase							) ** 2)
			lowerCAmelCase_         =      cos(sigma / 2							) ** 2
			lowerCAmelCase_         =      (sigma - sin(__lowerCAmelCase							)) * (x_numerator / x_demonimator)

			# Intermediate Y value
			# Y = (sigma + sin(sigma)) * cos^2Psin^2Q / sin^2(sigma/2)
			lowerCAmelCase_         =      (cos(__lowerCAmelCase							) ** 2) * (sin(__lowerCAmelCase							) ** 2)
			lowerCAmelCase_         =      sin(sigma / 2							) ** 2
			lowerCAmelCase_         =      (sigma + sin(__lowerCAmelCase							)) * (y_numerator / y_denominator)

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


if __name__ == "__main__":
			import doctest

			doctest.testmod()





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_A  =	{"configuration_sew": ["SEW_PRETRAINED_CONFIG_ARCHIVE_MAP", "SEWConfig"]}

try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			_A  =	[
			    "SEW_PRETRAINED_MODEL_ARCHIVE_LIST",
			    "SEWForCTC",
			    "SEWForSequenceClassification",
			    "SEWModel",
			    "SEWPreTrainedModel",
			]

if TYPE_CHECKING:
			from .configuration_sew import SEW_PRETRAINED_CONFIG_ARCHIVE_MAP, SEWConfig

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_sew import (
						    SEW_PRETRAINED_MODEL_ARCHIVE_LIST,
						    SEWForCTC,
						    SEWForSequenceClassification,
						    SEWModel,
						    SEWPreTrainedModel,
						)


else:
			import sys

			_A  =	_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)



