





"""simple docstring"""





from __future__ import annotations

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


def 			UpperCAmelCase__							(  SCREAMING_SNAKE_CASE     :						NDArray[floataa]							,						SCREAMING_SNAKE_CASE     :						NDArray[floataa]							,						SCREAMING_SNAKE_CASE     :						list[int]							,						SCREAMING_SNAKE_CASE     :						int							,						):







      '''simple docstring'''




      lowerCAmelCase  						=       coefficient_matrix.shape
      lowerCAmelCase  						=       constant_matrix.shape

      if rowsa != colsa:
            lowerCAmelCase  						=       F'Coefficient matrix dimensions must be nxn but received {rowsa}x{colsa}'
            raise ValueError(lowerCAmelCase_			)

      if colsa != 1:
            lowerCAmelCase  						=       F'Constant matrix must be nx1 but received {rowsa}x{colsa}'
            raise ValueError(lowerCAmelCase_			)

      if rowsa != rowsa:
            lowerCAmelCase  						=       (
                """Coefficient and constant matrices dimensions must be nxn and nx1 but """
                F'received {rowsa}x{colsa} and {rowsa}x{colsa}'
            )
            raise ValueError(lowerCAmelCase_			)

      if len(lowerCAmelCase_			) != rowsa:
            lowerCAmelCase  						=       (
                """Number of initial values must be equal to number of rows in coefficient """
                F'matrix but received {len(lowerCAmelCase_			)} and {rowsa}'
            )
            raise ValueError(lowerCAmelCase_			)

      if iterations <= 0:
            raise ValueError("""Iterations must be at least 1"""			)

      lowerCAmelCase  						=       np.concatenate(
          (coefficient_matrix, constant_matrix)							,						axis=1			)

      lowerCAmelCase  						=       table.shape

      strictly_diagonally_dominant(lowerCAmelCase_			)

      # Iterates the whole matrix for given number of times
      for _ in range(lowerCAmelCase_			):
            lowerCAmelCase  						=       []
            for row in range(lowerCAmelCase_			):
                  lowerCAmelCase  						=       0
                  for col in range(lowerCAmelCase_			):
                        if col == row:
                              lowerCAmelCase  						=       table[row][col]
                        elif col == cols - 1:
                              lowerCAmelCase  						=       table[row][col]
                        else:
                              temp += (-1) * table[row][col] * init_val[col]
                  lowerCAmelCase  						=       (temp + val) / denom
                  new_val.append(lowerCAmelCase_			)
            lowerCAmelCase  						=       new_val

      return [float(lowerCAmelCase_			) for i in new_val]


def 			UpperCAmelCase__							(  SCREAMING_SNAKE_CASE     :						NDArray[floataa]			):







      '''simple docstring'''




      lowerCAmelCase  						=       table.shape

      lowerCAmelCase  						=       True

      for i in range(0							,						lowerCAmelCase_			):
            lowerCAmelCase  						=       0
            for j in range(0							,						cols - 1			):
                  if i == j:
                        continue
                  else:
                        total += table[i][j]

            if table[i][i] <= total:
                  raise ValueError("""Coefficient matrix is not strictly diagonally dominant"""			)

      return is_diagonally_dominant


# Test Cases
if __name__ == "__main__":
       import doctest

       doctest.testmod()














from maths.prime_check import is_prime
def 					snake_case_						(   lowerCAmelCase_				:  int					):
							if not isinstance(lowerCAmelCase_				,				lowerCAmelCase_					):
														__lowercase					:							Dict			=   F"Input value of [number={number}] must be an integer"
														raise TypeError(lowerCAmelCase_					)
							if is_prime(lowerCAmelCase_					) and is_prime(number + 2					):
														return number + 2
							else:
														return -1


if __name__ == "__main__":
	import doctest

	doctest.testmod()