






'''simple docstring'''







import unittest

import numpy as np





def  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase				,			UpperCamelCase				,			UpperCamelCase = None				,			)      ->       np.ndarray:
							lowerCamelCase__					:	Tuple         =       np.shape(UpperCamelCase      )
							lowerCamelCase__					:	Optional[int]         =       np.shape(UpperCamelCase      )
							lowerCamelCase__					:	List[Any]         =       np.shape(UpperCamelCase      )

							if shape_a[0] != shape_b[0]:
														lowerCamelCase__					:	List[str]         =       (
														    """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__					:	Tuple         =       (
														    """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__					:	Optional[Any]         =       pseudo_inv
							if a_inv is None:
														try:
																					lowerCamelCase__					:	str         =       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 _lowercase	(				unittest.TestCase		):




							def 		lowerCamelCase_				(							self:				Dict     ):
														lowerCamelCase__					:	Optional[int]         =       np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]     )
														lowerCamelCase__					:	List[Any]         =       np.array([[0, 3], [3, 0], [2, 3]]     )
														lowerCamelCase__					:	Optional[Any]         =       np.array([[2, 1], [6, 3]]     )

														lowerCamelCase__					:	Dict         =       schur_complement(UpperCamelCase__			,							UpperCamelCase__			,							UpperCamelCase__     )

														lowerCamelCase__					:	Any         =       np.block([[a, b], [b.T, c]]     )

														lowerCamelCase__					:	List[Any]         =       np.linalg.det(UpperCamelCase__     )
														lowerCamelCase__					:	List[Any]         =       np.linalg.det(UpperCamelCase__     )
														lowerCamelCase__					:	Optional[Any]         =       np.linalg.det(UpperCamelCase__     )

														self.assertAlmostEqual(UpperCamelCase__			,							det_a * det_s     )




							def 		lowerCamelCase_				(							self:				Optional[Any]     ):
														lowerCamelCase__					:	List[Any]         =       np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]     )
														lowerCamelCase__					:	Tuple         =       np.array([[0, 3], [3, 0], [2, 3]]     )
														lowerCamelCase__					:	str         =       np.array([[2, 1], [6, 3]]     )

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




							def 		lowerCamelCase_				(							self:				Dict     ):
														lowerCamelCase__					:	Dict         =       np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]     )
														lowerCamelCase__					:	int         =       np.array([[0, 3], [3, 0], [2, 3]]     )
														lowerCamelCase__					:	List[str]         =       np.array([[2, 1, 3], [6, 3, 5]]     )

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


if __name__ == "__main__":
			import doctest

			doctest.testmod()
			unittest.main()









'''simple docstring'''







def  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase      )      ->       int:
							return abs(UpperCamelCase      ) if a == 0 else greatest_common_divisor(b % a				,			UpperCamelCase      )





def  SCREAMING_SNAKE_CASE_       (UpperCamelCase				,			UpperCamelCase      )      ->       int:
							while y:  # --> when y=0 then loop will terminate and return x as final GCD.
														lowerCamelCase__  ,		lowerCamelCase__					:	Tuple         =       y, x % y
							return abs(UpperCamelCase      )





def  SCREAMING_SNAKE_CASE_       ()      ->       Tuple:
							try:
														lowerCamelCase__					:	Dict         =       input("""Enter two integers separated by comma (,): """      ).split(""","""      )
														lowerCamelCase__					:	Any         =       int(nums[0]      )
														lowerCamelCase__					:	Optional[Any]         =       int(nums[1]      )
														print(
														    f'''greatest_common_divisor({num_a}, {num_a}) = '''
														    f'''{greatest_common_divisor(UpperCamelCase				,			UpperCamelCase      )}'''      )
														print(f'''By iterative gcd({num_a}, {num_a}) = {gcd_by_iterative(UpperCamelCase				,			UpperCamelCase      )}'''      )
							except (IndexError, UnboundLocalError, ValueError):
														print("""Wrong input"""      )


if __name__ == "__main__":
			main()

