





import numpy as np
from numpy import floataa
from numpy.typing import NDArray







def    UpperCAmelCase				(  _lowerCamelCase   :	Dict      , _lowerCamelCase   :	Tuple  ):





						'''simple docstring'''


						SCREAMING_SNAKE_CASE__  :					Dict =       np.shape(_lowerCamelCase  )

						SCREAMING_SNAKE_CASE__  :					NDArray[floataa] =       np.zeros((rows, 1)      , dtype=_lowerCamelCase  )
						for row in reversed(range(_lowerCamelCase  )  ):
												SCREAMING_SNAKE_CASE__  :					Tuple =       0
												for col in range(row + 1      , _lowerCamelCase  ):
																		total += coefficients[row, col] * x[col]

												SCREAMING_SNAKE_CASE__  :					Union[str, Any] =       (vector[row] - total) / coefficients[row, row]

						return x







def    UpperCAmelCase				(  _lowerCamelCase   :	Dict      , _lowerCamelCase   :	Tuple  ):





						'''simple docstring'''


						SCREAMING_SNAKE_CASE__  :					Any =       np.shape(_lowerCamelCase  )
						if rows != columns:
												return np.array(()      , dtype=_lowerCamelCase  )

						# augmented matrix
						SCREAMING_SNAKE_CASE__  :					NDArray[floataa] =       np.concatenate((coefficients, vector)      , axis=1  )
						SCREAMING_SNAKE_CASE__  :					Optional[Any] =       augmented_mat.astype("float64"  )

						# scale the matrix leaving it triangular
						for row in range(rows - 1  ):
												SCREAMING_SNAKE_CASE__  :					Any =       augmented_mat[row, row]
												for col in range(row + 1      , _lowerCamelCase  ):
																		SCREAMING_SNAKE_CASE__  :					Tuple =       augmented_mat[col, row] / pivot
																		augmented_mat[col, :] -= factor * augmented_mat[row, :]

						SCREAMING_SNAKE_CASE__  :					Any =       retroactive_resolution(
						    augmented_mat[:, 0:columns]      , augmented_mat[:, columns : columns + 1]  )

						return x


if __name__ == "__main__":
				import doctest

				doctest.testmod()







def    a__    (	A       ):
   return int(A       ) if x - int(A       ) >= 0 else int(A       ) - 1


if __name__ == "__main__":
 import doctest

 doctest.testmod()


