import logging

# standard libraries
import sys

import numpy as np
import pytest  # type: ignore

# Custom/local libraries
from matrix import matrix_operation as matop

_SCREAMING_SNAKE_CASE:						str    	=       [[12, 10], [3, 9]]
_SCREAMING_SNAKE_CASE:						Any    	=       [[3, 4], [7, 4]]
_SCREAMING_SNAKE_CASE:						int    	=       [[3, 0, 2], [2, 0, -2], [0, 1, 1]]
_SCREAMING_SNAKE_CASE:						Dict    	=       [[3, 0, -2], [2, 0, 2], [0, 1, 1]]
_SCREAMING_SNAKE_CASE:						List[Any]    	=       [[3, 0, 2], [2, 0, -2], [0, 1, 1], [2, 0, -2]]
_SCREAMING_SNAKE_CASE:						List[str]    	=       [1]
_SCREAMING_SNAKE_CASE:						List[str]    	=       [2]

_SCREAMING_SNAKE_CASE:						Optional[Any]    	=       logging.getLogger()
_SCREAMING_SNAKE_CASE:						List[Any]    	=       logging.DEBUG
_SCREAMING_SNAKE_CASE:						Any    	=       logging.StreamHandler(sys.stdout)
logger.addHandler(stream_handler)






@pytest.mark.mat_ops
@pytest.mark.parametrize(
    ("mat1", "mat2")							,	[(mat_a, mat_b), (mat_c, mat_d), (mat_d, mat_e), (mat_f, mat_h)]  )
def    UpperCAmelCase__(						lowerCamelCase_							,	lowerCamelCase_  ):



			"""simple docstring"""





			if (np.array(lowerCamelCase_  )).shape < (2, 2) or (np.array(lowerCamelCase_  )).shape < (2, 2):
						with pytest.raises(lowerCamelCase_  ):
									logger.info(f'\n\t{test_addition.__name__} returned integer'  )
									matop.add(lowerCamelCase_							,	lowerCamelCase_  )
			elif (np.array(lowerCamelCase_  )).shape == (np.array(lowerCamelCase_  )).shape:
						logger.info(f'\n\t{test_addition.__name__} with same matrix dims'  )
						_snake_case              =      (np.array(lowerCamelCase_  ) + np.array(lowerCamelCase_  )).tolist()
						_snake_case              =      matop.add(lowerCamelCase_							,	lowerCamelCase_  )
						assert theo == act
			else:
						with pytest.raises(lowerCamelCase_  ):
									logger.info(f'\n\t{test_addition.__name__} with different matrix dims'  )
									matop.add(lowerCamelCase_							,	lowerCamelCase_  )






@pytest.mark.mat_ops
@pytest.mark.parametrize(
    ("mat1", "mat2")							,	[(mat_a, mat_b), (mat_c, mat_d), (mat_d, mat_e), (mat_f, mat_h)]  )
def    UpperCAmelCase__(						lowerCamelCase_							,	lowerCamelCase_  ):



			"""simple docstring"""





			if (np.array(lowerCamelCase_  )).shape < (2, 2) or (np.array(lowerCamelCase_  )).shape < (2, 2):
						with pytest.raises(lowerCamelCase_  ):
									logger.info(f'\n\t{test_subtraction.__name__} returned integer'  )
									matop.subtract(lowerCamelCase_							,	lowerCamelCase_  )
			elif (np.array(lowerCamelCase_  )).shape == (np.array(lowerCamelCase_  )).shape:
						logger.info(f'\n\t{test_subtraction.__name__} with same matrix dims'  )
						_snake_case              =      (np.array(lowerCamelCase_  ) - np.array(lowerCamelCase_  )).tolist()
						_snake_case              =      matop.subtract(lowerCamelCase_							,	lowerCamelCase_  )
						assert theo == act
			else:
						with pytest.raises(lowerCamelCase_  ):
									logger.info(f'\n\t{test_subtraction.__name__} with different matrix dims'  )
									assert matop.subtract(lowerCamelCase_							,	lowerCamelCase_  )






@pytest.mark.mat_ops
@pytest.mark.parametrize(
    ("mat1", "mat2")							,	[(mat_a, mat_b), (mat_c, mat_d), (mat_d, mat_e), (mat_f, mat_h)]  )
def    UpperCAmelCase__(						lowerCamelCase_							,	lowerCamelCase_  ):



			"""simple docstring"""





			if (np.array(lowerCamelCase_  )).shape < (2, 2) or (np.array(lowerCamelCase_  )).shape < (2, 2):
						logger.info(f'\n\t{test_multiplication.__name__} returned integer'  )
						with pytest.raises(lowerCamelCase_  ):
									matop.add(lowerCamelCase_							,	lowerCamelCase_  )
			elif (np.array(lowerCamelCase_  )).shape == (np.array(lowerCamelCase_  )).shape:
						logger.info(f'\n\t{test_multiplication.__name__} meets dim requirements'  )
						_snake_case              =      (np.matmul(lowerCamelCase_							,	lowerCamelCase_  )).tolist()
						_snake_case              =      matop.multiply(lowerCamelCase_							,	lowerCamelCase_  )
						assert theo == act
			else:
						with pytest.raises(lowerCamelCase_  ):
									logger.info(
									    f'\n\t{test_multiplication.__name__} does not meet dim requirements'  )
									assert matop.subtract(lowerCamelCase_							,	lowerCamelCase_  )






@pytest.mark.mat_ops
def    UpperCAmelCase__(						):



			"""simple docstring"""





			_snake_case              =      (3.5 * np.array(lowerCamelCase_  )).tolist()
			_snake_case              =      matop.scalar_multiply(lowerCamelCase_							,	3.5  )
			assert theo == act






@pytest.mark.mat_ops
def    UpperCAmelCase__(						):



			"""simple docstring"""





			_snake_case              =      (np.identity(5  )).tolist()
			_snake_case              =      matop.identity(5  )
			assert theo == act







@pytest.mark.mat_ops
@pytest.mark.parametrize("mat"							,	[mat_a, mat_b, mat_c, mat_d, mat_e, mat_f]  )
def    UpperCAmelCase__(						lowerCamelCase_  ):



			"""simple docstring"""





			if (np.array(lowerCamelCase_  )).shape < (2, 2):
						with pytest.raises(lowerCamelCase_  ):
									logger.info(f'\n\t{test_transpose.__name__} returned integer'  )
									matop.transpose(lowerCamelCase_  )
			else:
						_snake_case              =      (np.transpose(lowerCamelCase_  )).tolist()
						_snake_case              =      matop.transpose(lowerCamelCase_							,	return_map=lowerCamelCase_  )
						assert theo == act


from math import gcd






def    UpperCAmelCase__(						lowerCamelCase_ = 12000  ):



			"""simple docstring"""





			_snake_case              =      0
			for d in range(max_d + 1  ):
						for n in range(d // 3 + 1							,	(d + 1) // 2  ):
									if gcd(lowerCamelCase_							,	lowerCamelCase_  ) == 1:
												fractions_number += 1
			return fractions_number


if __name__ == "__main__":
			print(F"{solution() = }")

