



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

from .haversine_distance import haversine_distance

__snake_case						:Dict						=					6_3_7_8_1_3_7.0
__snake_case						:Any						=					6_3_5_6_7_5_2.3_1_4_2_4_5
__snake_case						:Optional[int]						=					637_8137





def 					__snake_case     (      _UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase    ):
    __a							=    (AXIS_A - AXIS_B) / AXIS_A
    # Parametric latitudes
    # https://en.wikipedia.org/wiki/Latitude#Parametric_(or_reduced)_latitude
    __a							=    atan((1 - flattening) * tan(radians(_UpperCAmelCase    )    )    )
    __a							=    atan((1 - flattening) * tan(radians(_UpperCAmelCase    )    )    )

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

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

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

    # Intermediate Y value
    # Y = (sigma + sin(sigma)) * cos^2Psin^2Q / sin^2(sigma/2)
    __a							=    (cos(_UpperCAmelCase    ) ** 2) * (sin(_UpperCAmelCase    ) ** 2)
    __a							=    sin(sigma / 2    ) ** 2
    __a							=    (sigma + sin(_UpperCAmelCase    )) * (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_tokenizers_available, is_torch_available


__snake_case						:Tuple						=					{
    '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''],
}
try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __snake_case						:List[Any]						=					['''BloomTokenizerFast''']

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __snake_case						:Any						=					[
     '''BLOOM_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''BloomForCausalLM''',
     '''BloomModel''',
     '''BloomPreTrainedModel''',
     '''BloomForSequenceClassification''',
     '''BloomForTokenClassification''',
     '''BloomForQuestionAnswering''',
 ]

if TYPE_CHECKING:
 from .configuration_bloom import BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP, BloomConfig, BloomOnnxConfig

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_bloom_fast import BloomTokenizerFast

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_bloom import (
      BLOOM_PRETRAINED_MODEL_ARCHIVE_LIST,
      BloomForCausalLM,
      BloomForQuestionAnswering,
      BloomForSequenceClassification,
      BloomForTokenClassification,
      BloomModel,
      BloomPreTrainedModel,
  )

else:
 import sys

 __snake_case						:Any						=					_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





