def 			A__  (	snake_case_ :		list[list]      ):
 SCREAMING_SNAKE_CASE__:   List[Any]=      current_set.copy()
 for row_index, row in enumerate(snake_case_      ):
  SCREAMING_SNAKE_CASE__:   str=      row[0]
  for column_index, column in enumerate(snake_case_      ):
   if magnitude == 0:
    SCREAMING_SNAKE_CASE__:   Any=      column
    continue
   SCREAMING_SNAKE_CASE__:   Dict=      column / magnitude
    # Subtract to cancel term
 SCREAMING_SNAKE_CASE__:   Optional[Any]=      current_set[0]
 SCREAMING_SNAKE_CASE__:   Any=      [first_row]
 SCREAMING_SNAKE_CASE__:   str=      current_set[1::]
 for row in current_set:
  SCREAMING_SNAKE_CASE__:   Dict=      []
  # If first term is 0, it is already in form we want, so we preserve it
  if row[0] == 0:
   final_set.append(snake_case_      )
   continue
  for column_index in range(len(snake_case_      )      ):
   temp_row.append(first_row[column_index] - row[column_index]      )
  final_set.append(snake_case_      )
 # Create next recursion iteration set
 if len(final_set[0]      ) != 3:
  SCREAMING_SNAKE_CASE__:   Tuple=      final_set[0]
  SCREAMING_SNAKE_CASE__:   Dict=      []
  SCREAMING_SNAKE_CASE__:   List[str]=      []
  for row in final_set[1::]:
   current_first_column.append(row[0]      )
   next_iteration.append(row[1::]      )
  SCREAMING_SNAKE_CASE__:   List[Any]=      simplify(snake_case_      )
  for i in range(len(snake_case_      )      ):
   resultant[i].insert(0       ,				current_first_column[i]      )
  resultant.insert(0       ,				snake_case_      )
  SCREAMING_SNAKE_CASE__:   Optional[Any]=      resultant
 return final_set







def 			A__  (	snake_case_ :		list[list]      ):
 if len(snake_case_      ) == 0:
  raise IndexError('''solve_simultaneous() requires n lists of length n+1'''      )
 SCREAMING_SNAKE_CASE__:   Dict=      len(snake_case_      ) + 1
 if any(len(snake_case_      ) != _length for item in equations      ):
  raise IndexError('''solve_simultaneous() requires n lists of length n+1'''      )
 for row in equations:
  if any(not isinstance(snake_case_       ,				(int, float)      ) for column in row      ):
   raise ValueError('''solve_simultaneous() requires lists of integers'''      )
 if len(snake_case_      ) == 1:
  return [equations[0][-1] / equations[0][0]]
 SCREAMING_SNAKE_CASE__:   str=      equations.copy()
 if any(0 in row for row in data_set      ):
  SCREAMING_SNAKE_CASE__:   Dict=      data_set.copy()
  SCREAMING_SNAKE_CASE__:   Union[str, Any]=      []
  for row_index, row in enumerate(snake_case_      ):
   if 0 not in row:
    SCREAMING_SNAKE_CASE__:   List[Any]=      data_set.pop(snake_case_      )
    break
  if not full_row:
   raise ValueError('''solve_simultaneous() requires at least 1 full equation'''      )
  data_set.insert(0       ,				snake_case_      )
 SCREAMING_SNAKE_CASE__:   int=      data_set.copy()
 SCREAMING_SNAKE_CASE__:   int=      simplify(snake_case_      )
 SCREAMING_SNAKE_CASE__:   List[Any]=      simplified[::-1]
 SCREAMING_SNAKE_CASE__:   list=      []
 for row in simplified:
  SCREAMING_SNAKE_CASE__:   Optional[int]=      row[-1]
  if not solutions:
   if row[-2] == 0:
    solutions.append(0      )
    continue
   solutions.append(current_solution / row[-2]      )
   continue
  SCREAMING_SNAKE_CASE__:   Tuple=      row.copy()[: len(snake_case_      ) - 1 :]
  while temp_row[0] == 0:
   temp_row.pop(0      )
  if len(snake_case_      ) == 0:
   solutions.append(0      )
   continue
  SCREAMING_SNAKE_CASE__:   List[Any]=      temp_row[1::]
  SCREAMING_SNAKE_CASE__:   List[Any]=      temp_row[::-1]
  for column_index, column in enumerate(snake_case_      ):
   current_solution -= column * solutions[column_index]
  solutions.append(snake_case_      )
 SCREAMING_SNAKE_CASE__:   List[Any]=      []
 for item in solutions:
  final.append(float(round(snake_case_       ,				5      )      )      )
 return final[::-1]


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      lowercase_     :   Tuple 				=				[
          [2, 1, 1, 1, 1, 4],
          [1, 2, 1, 1, 1, 5],
          [1, 1, 2, 1, 1, 6],
          [1, 1, 1, 2, 1, 7],
          [1, 1, 1, 1, 2, 8],
      ]
      print(solve_simultaneous(eq))
      print(solve_simultaneous([[4, 2]]))


# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import sys
import warnings
from os.path import abspath, dirname, join


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
lowercase_     :   List[str] 				=				abspath(join(dirname(dirname(__file__)), 'src'))
sys.path.insert(1, git_repo_path)

# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action='ignore', category=FutureWarning)







def 			A__      (	snake_case_ :		Optional[int]      ):
 from diffusers.utils.testing_utils import pytest_addoption_shared

 pytest_addoption_shared(snake_case_      )







def 			A__      (	snake_case_ :		Optional[int]      ):
 from diffusers.utils.testing_utils import pytest_terminal_summary_main

 SCREAMING_SNAKE_CASE__:   Optional[int]=      terminalreporter.config.getoption('''--make-reports'''      )
 if make_reports:
  pytest_terminal_summary_main(snake_case_       ,				id=snake_case_      )

