

"""simple docstring"""




import unittest
from timeit import timeit



def 						UpperCAmelCase__ (					A__						,     A__ )   ->   int:




   """simple docstring"""
   lowerCamelCase__						       =      first_num if first_num >= second_num else second_num
   lowerCamelCase__						       =      max_num
   while (common_mult % first_num > 0) or (common_mult % second_num > 0):
      common_mult += max_num
   return common_mult



def 						UpperCAmelCase__ (					A__						,     A__ )   ->   int:




   """simple docstring"""
   return b if a == 0 else greatest_common_divisor(b % a						,     A__ )



def 						UpperCAmelCase__ (					A__						,     A__ )   ->   int:




   """simple docstring"""
   return first_num // greatest_common_divisor(A__						,     A__ ) * second_num



def 						UpperCAmelCase__ (					)   ->   Tuple:




   """simple docstring"""
   lowerCamelCase__						       =      (
       "from __main__ import least_common_multiple_slow, least_common_multiple_fast"
   )
   print(
       "least_common_multiple_slow():"						,     timeit("least_common_multiple_slow(1000, 999)"						,     setup=A__ )						,     )
   print(
       "least_common_multiple_fast():"						,     timeit("least_common_multiple_fast(1000, 999)"						,     setup=A__ )						,     )


class 		_A							(      unittest.TestCase       ):
      __a             =						(
          (10, 20),
          (13, 15),
          (4, 31),
          (10, 42),
          (43, 34),
          (5, 12),
          (12, 25),
          (10, 25),
          (6, 9),
      )
      __a             =						(20, 195, 124, 210, 1462, 60, 300, 50, 18)





      def        _lowerCamelCase	(	self		) ->       str:
         for i, (first_num, second_num) in enumerate(self.test_inputs		):
            lowerCamelCase__						       =      least_common_multiple_slow(SCREAMING_SNAKE_CASE__     ,    SCREAMING_SNAKE_CASE__		)
            lowerCamelCase__						       =      least_common_multiple_fast(SCREAMING_SNAKE_CASE__     ,    SCREAMING_SNAKE_CASE__		)
            with self.subTest(i=SCREAMING_SNAKE_CASE__		):
               self.assertEqual(SCREAMING_SNAKE_CASE__     ,    self.expected_results[i]		)
               self.assertEqual(SCREAMING_SNAKE_CASE__     ,    self.expected_results[i]		)


if __name__ == "__main__":
     benchmark()
     unittest.main()







"""simple docstring"""




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



def 						UpperCAmelCase__ (					A__						,     A__ )   ->   NDArray[floataa]:




   """simple docstring"""
   lowerCamelCase__       ,							lowerCamelCase__						       =      np.shape(A__ )

   lowerCamelCase__						       =      np.zeros((rows, 1)						,     dtype=A__ )
   for row in reversed(range(A__ ) ):
      lowerCamelCase__						       =      0
      for col in range(row + 1						,     A__ ):
         total += coefficients[row, col] * x[col]

      lowerCamelCase__						       =      (vector[row] - total) / coefficients[row, row]

   return x



def 						UpperCAmelCase__ (					A__						,     A__ )   ->   NDArray[floataa]:




   """simple docstring"""
   lowerCamelCase__       ,							lowerCamelCase__						       =      np.shape(A__ )
   if rows != columns:
      return np.array(()						,     dtype=A__ )

   # augmented matrix
   lowerCamelCase__						       =      np.concatenate((coefficients, vector)						,     axis=1 )
   lowerCamelCase__						       =      augmented_mat.astype("float64" )

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

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

   return x


if __name__ == "__main__":
     import doctest

     doctest.testmod()




