

from __future__ import annotations

from typing import Any

def 							__SCREAMING_SNAKE_CASE							( *lowerCAmelCase:     List[str]       )      ->				List[Any]:
				if all(_check_not_integer(_lowerCamelCase       ) for m in matrix_s       ):
								for i in matrix_s[1:]:
												_verify_matrix_sizes(matrix_s[0]     ,					_lowerCamelCase       )
								return [[sum(_lowerCamelCase       ) for t in zip(*_lowerCamelCase       )] for m in zip(*_lowerCamelCase       )]
				raise TypeError("Expected a matrix, got int/list instead"       )

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     Any     ,					lowerCAmelCase:     List[Any]       )      ->				int:
				if (
				    _check_not_integer(_lowerCamelCase       )
				    and _check_not_integer(_lowerCamelCase       )
				    and _verify_matrix_sizes(_lowerCamelCase     ,					_lowerCamelCase       )
				):
								return [[i - j for i, j in zip(*_lowerCamelCase       )] for m in zip(_lowerCamelCase     ,					_lowerCamelCase       )]
				raise TypeError("Expected a matrix, got int/list instead"       )

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     Optional[int]     ,					lowerCAmelCase:     Any       )      ->				int:
				return [[x * n for x in row] for row in matrix]

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     Union[str, Any]     ,					lowerCAmelCase:     List[Any]       )      ->				List[Any]:
				if _check_not_integer(_lowerCamelCase       ) and _check_not_integer(_lowerCamelCase       ):
								_UpperCAmelCase				:						Dict       						=			_verify_matrix_sizes(_lowerCamelCase     ,					_lowerCamelCase       )

				if cols[0] != rows[1]:
								_UpperCAmelCase				:						Any       						=			(
								    'Cannot multiply matrix of dimensions '
								    F'({rows[0]},{cols[0]}) and ({rows[1]},{cols[1]})'
								)
								raise ValueError(_lowerCamelCase       )
				return [
				    [sum(m * n for m, n in zip(_lowerCamelCase     ,					_lowerCamelCase       )       ) for j in zip(*_lowerCamelCase       )] for i in matrix_a
				]

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     Dict       )      ->				int:
				_UpperCAmelCase				:						Union[str, Any]       						=			int(_lowerCamelCase       )
				return [[int(row == column       ) for column in range(_lowerCamelCase       )] for row in range(_lowerCamelCase       )]

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     List[Any]     ,					lowerCAmelCase:     str = True       )      ->				Optional[Any]:
				if _check_not_integer(_lowerCamelCase       ):
								if return_map:
												return map(_lowerCamelCase     ,					zip(*_lowerCamelCase       )       )
								else:
												return list(map(_lowerCamelCase     ,					zip(*_lowerCamelCase       )       )       )
				raise TypeError("Expected a matrix, got int/list instead"       )

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     int     ,					lowerCAmelCase:     str     ,					lowerCAmelCase:     Optional[Any]       )      ->				int:
				_UpperCAmelCase				:						str       						=			matrix[:row] + matrix[row + 1 :]
				return [row[:column] + row[column + 1 :] for row in minor]

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     Any       )      ->				Optional[int]:
				if len(_lowerCamelCase       ) == 1:
								return matrix[0][0]

				return sum(
				    x * determinant(minor(_lowerCamelCase     ,					0     ,					_lowerCamelCase       )       ) * (-1) ** i
				    for i, x in enumerate(matrix[0]       )       )

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     Tuple       )      ->				Tuple:
				_UpperCAmelCase				:						Dict       						=			determinant(_lowerCamelCase       )
				if det == 0:
								return None

				_UpperCAmelCase				:						Dict       						=			[
				    [determinant(minor(_lowerCamelCase     ,					_lowerCamelCase     ,					_lowerCamelCase       )       ) for j in range(len(_lowerCamelCase       )       )]
				    for i in range(len(_lowerCamelCase       )       )
				]

				_UpperCAmelCase				:						List[str]       						=			[
				    [x * (-1) ** (row + col) for col, x in enumerate(matrix_minor[row]       )]
				    for row in range(len(_lowerCamelCase       )       )
				]
				_UpperCAmelCase				:						List[str]       						=			list(transpose(_lowerCamelCase       )       )
				return scalar_multiply(_lowerCamelCase     ,					1 / det       )

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     int       )      ->				List[Any]:
				return not isinstance(_lowerCamelCase     ,					_lowerCamelCase       ) and not isinstance(matrix[0]     ,					_lowerCamelCase       )

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     List[Any]       )      ->				Dict:
				return len(_lowerCamelCase       ), len(matrix[0]       )

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     Optional[int]     ,					lowerCAmelCase:     int       )      ->				Any:
				_UpperCAmelCase				:						Tuple       						=			_shape(_lowerCamelCase       ) + _shape(_lowerCamelCase       )
				if shape[0] != shape[3] or shape[1] != shape[2]:
								_UpperCAmelCase				:						List[Any]       						=			(
								    'operands could not be broadcast together with shape '
								    F'({shape[0], shape[1]}), ({shape[2], shape[3]})'
								)
								raise ValueError(_lowerCamelCase       )
				return (shape[0], shape[2]), (shape[1], shape[3])

def 							__SCREAMING_SNAKE_CASE							( )      ->				Optional[int]:
				_UpperCAmelCase				:						Optional[Any]       						=			[[12, 10], [3, 9]]
				_UpperCAmelCase				:						Optional[Any]       						=			[[3, 4], [7, 4]]
				_UpperCAmelCase				:						Any       						=			[[11, 12, 13, 14], [21, 22, 23, 24], [31, 32, 33, 34], [41, 42, 43, 44]]
				_UpperCAmelCase				:						List[str]       						=			[[3, 0, 2], [2, 0, -2], [0, 1, 1]]
				print(F'Add Operation, {add(_lowerCamelCase     ,					_lowerCamelCase       ) = } \n'       )
				print(
				    F'Multiply Operation, {multiply(_lowerCamelCase     ,					_lowerCamelCase       ) = } \n'     ,					)
				print(F'Identity: {identity(5       )}\n'       )
				print(F'Minor of {matrix_c} = {minor(_lowerCamelCase     ,					1     ,					2       )} \n'       )
				print(F'Determinant of {matrix_b} = {determinant(_lowerCamelCase       )} \n'       )
				print(F'Inverse of {matrix_d} = {inverse(_lowerCamelCase       )}\n'       )


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					main()










"""simple docstring"""
def        lowerCamelCase_  (						_lowerCamelCase				):
 return 1 if input_a == 0 else 0






def        lowerCamelCase_  (						):
 assert not_gate(0				) == 1
 assert not_gate(1				) == 0


if __name__ == "__main__":
      print(not_gate(0))
      print(not_gate(1))

