




import unittest

import numpy as np







def 				lowerCAmelCase_	(     snake_case_,snake_case_,snake_case_,snake_case_ = None,):
      _A							:     Union[str, Any]			=						np.shape(snake_case_     )
      _A							:     Optional[Any]			=						np.shape(snake_case_     )
      _A							:     Any			=						np.shape(snake_case_     )

      if shape_a[0] != shape_b[0]:
            _A							:     List[Any]			=						(
                """Expected the same number of rows for A and B. """
                f'''Instead found A of size {shape_a} and B of size {shape_b}'''
            )
            raise ValueError(snake_case_     )

      if shape_b[1] != shape_c[1]:
            _A							:     List[Any]			=						(
                """Expected the same number of columns for B and C. """
                f'''Instead found B of size {shape_b} and C of size {shape_c}'''
            )
            raise ValueError(snake_case_     )

      _A							:     Dict			=						pseudo_inv
      if a_inv is None:
            try:
                  _A							:     int			=						np.linalg.inv(snake_case_     )
            except np.linalg.LinAlgError:
                  raise ValueError(
                      """Input matrix A is not invertible. Cannot compute Schur complement."""     )

      return mat_c - mat_b.T @ a_inv @ mat_b







class 						lowercase							(   unittest.TestCase		):

     def 					a__	(  self				)						->							None:
           _A							:     int			=						np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]				)
           _A							:     Union[str, Any]			=						np.array([[0, 3], [3, 0], [2, 3]]				)
           _A							:     int			=						np.array([[2, 1], [6, 3]]				)

           _A							:     Tuple			=						schur_complement(_a		,     _a		,     _a				)

           _A							:     Union[str, Any]			=						np.block([[a, b], [b.T, c]]				)

           _A							:     Any			=						np.linalg.det(_a				)
           _A							:     Dict			=						np.linalg.det(_a				)
           _A							:     Tuple			=						np.linalg.det(_a				)

           self.assertAlmostEqual(_a		,     det_a * det_s				)

     def 					a__	(  self				)						->							None:
           _A							:     Optional[int]			=						np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]				)
           _A							:     Dict			=						np.array([[0, 3], [3, 0], [2, 3]]				)
           _A							:     Union[str, Any]			=						np.array([[2, 1], [6, 3]]				)

           with self.assertRaises(_a				):
                 schur_complement(_a		,     _a		,     _a				)



     def 					a__	(  self				)						->							None:
           _A							:     List[str]			=						np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]				)
           _A							:     Any			=						np.array([[0, 3], [3, 0], [2, 3]]				)
           _A							:     Optional[int]			=						np.array([[2, 1, 3], [6, 3, 5]]				)

           with self.assertRaises(_a				):
                 schur_complement(_a		,     _a		,     _a				)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  unittest.main()



from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


A     :	Optional[int]    = {
    'configuration_whisper': ['WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'WhisperConfig', 'WhisperOnnxConfig'],
    'feature_extraction_whisper': ['WhisperFeatureExtractor'],
    'processing_whisper': ['WhisperProcessor'],
    'tokenization_whisper': ['WhisperTokenizer'],
}

try:
					if not is_tokenizers_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					A     :	int    = ['WhisperTokenizerFast']

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					A     :	str    = [
					    'WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST',
					    'WhisperForConditionalGeneration',
					    'WhisperModel',
					    'WhisperPreTrainedModel',
					    'WhisperForAudioClassification',
					]

try:
					if not is_tf_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					A     :	Tuple    = [
					    'TF_WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST',
					    'TFWhisperForConditionalGeneration',
					    'TFWhisperModel',
					    'TFWhisperPreTrainedModel',
					]

try:
					if not is_flax_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					A     :	int    = [
					    'FlaxWhisperForConditionalGeneration',
					    'FlaxWhisperModel',
					    'FlaxWhisperPreTrainedModel',
					    'FlaxWhisperForAudioClassification',
					]


if TYPE_CHECKING:
					from .configuration_whisper import WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP, WhisperConfig, WhisperOnnxConfig
					from .feature_extraction_whisper import WhisperFeatureExtractor
					from .processing_whisper import WhisperProcessor
					from .tokenization_whisper import WhisperTokenizer

					try:
										if not is_tokenizers_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .tokenization_whisper_fast import WhisperTokenizerFast

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_whisper import (
										    WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST,
										    WhisperForAudioClassification,
										    WhisperForConditionalGeneration,
										    WhisperModel,
										    WhisperPreTrainedModel,
										)

					try:
										if not is_tf_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_tf_whisper import (
										    TF_WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST,
										    TFWhisperForConditionalGeneration,
										    TFWhisperModel,
										    TFWhisperPreTrainedModel,
										)

					try:
										if not is_flax_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_flax_whisper import (
										    FlaxWhisperForAudioClassification,
										    FlaxWhisperForConditionalGeneration,
										    FlaxWhisperModel,
										    FlaxWhisperPreTrainedModel,
										)

else:
					import sys

					A     :	Tuple    = _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)