Hi Софья!
This is specifically a pytorch forum, so it is probably not the best
place to ask your question.  I’m not really sure where the best place
would be, but maybe stackoverflow would be a better (more general)
fit.
However …



 111323:

A = np.matrix([[4, -1, -6, 0],
              [-5, -4, 10, 8],
              [0, 9, 4, -2],
              [1, 0, -7, 5]])

…
  File "sol.py", line 22, in sor_solver
    sigma += A[i][j] * phi[j]
  File "C:\Users\1\AppData\Local\Programs\Python\Python38-32\lib\site-packages\numpy\matrixlib\defmatrix.py", line 195, in __getitem__
    out = N.ndarray.__getitem__(self, index)
IndexError: index 1 is out of bounds for axis 0 with size 1



A is a numpy matrix so you need to index it as A[i, j] (rather than
as A[i][j]).
For example, try running this script:
import numpy as np
A = np.matrix([[4, -1, -6, 0],
              [-5, -4, 10, 8],
              [0, 9, 4, -2],
              [1, 0, -7, 5]])
A[1, 1]
A[1][1]

Best.
K. Frank