


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

from .haversine_distance import haversine_distance

_lowercase       		= 6378137.0
_lowercase       		= 6356752.314245
_lowercase       		= 6378137

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

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

						# Intermediate P and Q values
						lowerCAmelCase_	:     Optional[Any]          = (b_lata + b_lata) / 2
						lowerCAmelCase_	:     Union[str, Any]          = (b_lata - b_lata) / 2

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

						# Intermediate Y value
						# Y = (sigma + sin(sigma)) * cos^2Psin^2Q / sin^2(sigma/2)
						lowerCAmelCase_	:     int          = (cos(snake_case__) ** 2) * (sin(snake_case__) ** 2)
						lowerCAmelCase_	:     Any          = sin(sigma / 2) ** 2
						lowerCAmelCase_	:     Dict          = (sigma + sin(snake_case__)) * (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_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


__lowerCAmelCase					   =       {
    'configuration_deberta': ['DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DebertaConfig', 'DebertaOnnxConfig'],
    'tokenization_deberta': ['DebertaTokenizer'],
}

try:
							if not is_tokenizers_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__lowerCAmelCase					   =       ['DebertaTokenizerFast']

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__lowerCAmelCase					   =       [
							    'DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'DebertaForMaskedLM',
							    'DebertaForQuestionAnswering',
							    'DebertaForSequenceClassification',
							    'DebertaForTokenClassification',
							    'DebertaModel',
							    'DebertaPreTrainedModel',
							]

try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__lowerCAmelCase					   =       [
							    'TF_DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'TFDebertaForMaskedLM',
							    'TFDebertaForQuestionAnswering',
							    'TFDebertaForSequenceClassification',
							    'TFDebertaForTokenClassification',
							    'TFDebertaModel',
							    'TFDebertaPreTrainedModel',
							]


if TYPE_CHECKING:
							from .configuration_deberta import DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP, DebertaConfig, DebertaOnnxConfig
							from .tokenization_deberta import DebertaTokenizer

							try:
														if not is_tokenizers_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_deberta_fast import DebertaTokenizerFast

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_deberta import (
														    DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
														    DebertaForMaskedLM,
														    DebertaForQuestionAnswering,
														    DebertaForSequenceClassification,
														    DebertaForTokenClassification,
														    DebertaModel,
														    DebertaPreTrainedModel,
														)

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_deberta import (
														    TF_DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TFDebertaForMaskedLM,
														    TFDebertaForQuestionAnswering,
														    TFDebertaForSequenceClassification,
														    TFDebertaForTokenClassification,
														    TFDebertaModel,
														    TFDebertaPreTrainedModel,
														)


else:
							import sys

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