


'''simple docstring'''

import unittest

import numpy as np





def __snake_case   ( UpperCAmelCase_		:		Union[str, Any]   ,							UpperCAmelCase_		:		str   ,							UpperCAmelCase_		:		Optional[Any]   ,							UpperCAmelCase_		:		List[str] = None   ,							):
 lowerCamelCase_						=    np.shape(UpperCAmelCase_						)
 lowerCamelCase_						=    np.shape(UpperCAmelCase_						)
 lowerCamelCase_						=    np.shape(UpperCAmelCase_						)

 if shape_a[0] != shape_b[0]:
  lowerCamelCase_						=    (
      "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(UpperCAmelCase_						)

 if shape_b[1] != shape_c[1]:
  lowerCamelCase_						=    (
      "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(UpperCAmelCase_						)

 lowerCamelCase_						=    pseudo_inv
 if a_inv is None:
  try:
   lowerCamelCase_						=    np.linalg.inv(UpperCAmelCase_						)
  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 	snake_case       (       unittest.TestCase     ):





  """simple docstring"""




  def     snake_case						(       self	):







   """simple docstring"""
   lowerCamelCase_						=    np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]	)
   lowerCamelCase_						=    np.array([[0, 3], [3, 0], [2, 3]]	)
   lowerCamelCase_						=    np.array([[2, 1], [6, 3]]	)

   lowerCamelCase_						=    schur_complement(lowerCamelCase__     ,    lowerCamelCase__     ,    lowerCamelCase__	)

   lowerCamelCase_						=    np.block([[a, b], [b.T, c]]	)

   lowerCamelCase_						=    np.linalg.det(lowerCamelCase__	)
   lowerCamelCase_						=    np.linalg.det(lowerCamelCase__	)
   lowerCamelCase_						=    np.linalg.det(lowerCamelCase__	)

   self.assertAlmostEqual(lowerCamelCase__     ,    det_a * det_s	)






  def     snake_case						(       self	):







   """simple docstring"""
   lowerCamelCase_						=    np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]	)
   lowerCamelCase_						=    np.array([[0, 3], [3, 0], [2, 3]]	)
   lowerCamelCase_						=    np.array([[2, 1], [6, 3]]	)

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







  def     snake_case						(       self	):







   """simple docstring"""
   lowerCamelCase_						=    np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]	)
   lowerCamelCase_						=    np.array([[0, 3], [3, 0], [2, 3]]	)
   lowerCamelCase_						=    np.array([[2, 1, 3], [6, 3, 5]]	)

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


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     unittest.main()






__lowercase				      =						[4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
__lowercase				      =						[3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
__lowercase				      =						{
    0: """Sunday""",
    1: """Monday""",
    2: """Tuesday""",
    3: """Wednesday""",
    4: """Thursday""",
    5: """Friday""",
    6: """Saturday""",
}







def 							_lowerCamelCase   (			SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE   ):
      '''simple docstring'''







      assert len(str(SCREAMING_SNAKE_CASE   )   ) > 2, "year should be in YYYY format"
      assert 1 <= month <= 12, "month should be between 1 to 12"
      assert 1 <= day <= 31, "day should be between 1 to 31"

      # Doomsday algorithm:
      A_							       =		year // 100
      A_							       =		(5 * (century % 4) + 2) % 7
      A_							       =		year % 100
      A_							       =		centurian % 12
      A_							       =		(
          (centurian // 12) + centurian_m + (centurian_m // 4) + century_anchor
      ) % 7
      A_							       =		(
          DOOMSDAY_NOT_LEAP[month - 1]
          if (year % 4 != 0) or (centurian == 0 and (year % 400) == 0)
          else DOOMSDAY_LEAP[month - 1]
      )
      A_							       =		(dooms_day + day - day_anchor) % 7
      return WEEK_DAY_NAMES[week_day]


if __name__ == "__main__":
      import doctest

      doctest.testmod()





