mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-26 02:48:40 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
5fa2a6e7b6
commit
8e21133d25
@ -10,10 +10,10 @@ from numpy.typing import NDArray
|
|||||||
|
|
||||||
# Method to find solution of system of linear equations
|
# Method to find solution of system of linear equations
|
||||||
def jacobi_iteration_method(
|
def jacobi_iteration_method(
|
||||||
coefficient_matrix: NDArray[float64],
|
coefficient_matrix: NDArray[float64],
|
||||||
constant_matrix: NDArray[float64],
|
constant_matrix: NDArray[float64],
|
||||||
init_val: list[int],
|
init_val: list[int],
|
||||||
iterations: int,
|
iterations: int,
|
||||||
) -> list[float]:
|
) -> list[float]:
|
||||||
"""
|
"""
|
||||||
Jacobi Iteration Method:
|
Jacobi Iteration Method:
|
||||||
@ -118,12 +118,12 @@ def jacobi_iteration_method(
|
|||||||
"""
|
"""
|
||||||
denom - a list of values along the diagonal
|
denom - a list of values along the diagonal
|
||||||
val - values of the last column of the table array
|
val - values of the last column of the table array
|
||||||
masks - boolean mask of all strings without diagonal elements array coefficient_matrix
|
masks - boolean mask of all strings without diagonal elements array coefficient_matrix
|
||||||
ttt - coefficient_matrix array values without diagonal elements
|
ttt - coefficient_matrix array values without diagonal elements
|
||||||
ind - column indexes for each row without diagonal elements
|
ind - column indexes for each row without diagonal elements
|
||||||
arr - list obtained by column indexes from the list init_val
|
arr - list obtained by column indexes from the list init_val
|
||||||
|
|
||||||
the code below uses vectorized operations based on
|
the code below uses vectorized operations based on
|
||||||
the previous algorithm on loopss:
|
the previous algorithm on loopss:
|
||||||
|
|
||||||
# Iterates the whole matrix for given number of times
|
# Iterates the whole matrix for given number of times
|
||||||
|
6
main.py
6
main.py
@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
def print_hi(name):
|
def print_hi(name):
|
||||||
# Use a breakpoint in the code line below to debug your script.
|
# Use a breakpoint in the code line below to debug your script.
|
||||||
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
|
print(f"Hi, {name}") # Press Ctrl+F8 to toggle the breakpoint.
|
||||||
|
|
||||||
|
|
||||||
# Press the green button in the gutter to run the script.
|
# Press the green button in the gutter to run the script.
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
print_hi('PyCharm')
|
print_hi("PyCharm")
|
||||||
|
|
||||||
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
|
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user