
'''simple docstring'''





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







def snake_case_    (				lowercase__      ,					lowercase__		):
  UpperCAmelCase__					, UpperCAmelCase__			:				Tuple												=       np.shape(lowercase__		)

  UpperCAmelCase__			:				NDArray[floataa]												=       np.zeros((rows, 1)      ,					dtype=lowercase__		)
  for row in reversed(range(lowercase__		)		):
    UpperCAmelCase__			:				Union[str, Any]												=       0
    for col in range(row + 1      ,					lowercase__		):
      total += coefficients[row, col] * x[col]

    UpperCAmelCase__			:				List[str]												=       (vector[row] - total) / coefficients[row, row]

  return x







def snake_case_    (				lowercase__      ,					lowercase__		):
  UpperCAmelCase__					, UpperCAmelCase__			:				Optional[int]												=       np.shape(lowercase__		)
  if rows != columns:
    return np.array(()      ,					dtype=lowercase__		)

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

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

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

  return x


if __name__ == "__main__":
      import doctest

      doctest.testmod()





'''simple docstring'''





from doctest import testmod
from math import sqrt







def snake_case_    (				lowercase__		):
  UpperCAmelCase__			:				list[int]												=       []
  if num < 1:
    return facs
  facs.append(1		)
  if num == 1:
    return facs
  facs.append(lowercase__		)
  for i in range(2      ,					int(sqrt(lowercase__		)		) + 1		):
    if num % i == 0:  # If i is a factor of num
      facs.append(lowercase__		)
      UpperCAmelCase__			:				Tuple												=       num // i  # num//i is the other factor of num
      if d != i:  # If d and i are distinct
        facs.append(lowercase__		)  # we have found another factor
  facs.sort()
  return facs


if __name__ == "__main__":
      testmod(name="""factors_of_a_number""", verbose=True)



