Function factorize_tridiag_matrix receives only an argument (A), but the very first line asks len(b), which is undefined in this scope.
Seeing as it is called in solve_tridiag_linear_system (which receives A and b arguments), I propose b is included in the arguments of factorize_tridiag_matrix.
Alternatively one could use A.shape[0], which should return the same value, however, further down the function the line c[0] = b[0]pops up. And again, if b is not passed as an argument, it is undefined (or ill-defined) in this context.
So, the full changes for this to work are:
in solve_tridiag_linear_system change c, d = factorize_tridiag_matrix(A) to c, d = factorize_tridiag_matrix(A, b)
in factorize_tridiag_matrix change def factorize_tridiag_matrix(A): to def factorize_tridiag_matrix(A, b):
Function
factorize_tridiag_matrix
receives only an argument (A
), but the very first line askslen(b)
, which is undefined in this scope.Seeing as it is called in
solve_tridiag_linear_system
(which receivesA
andb
arguments), I proposeb
is included in the arguments offactorize_tridiag_matrix
.Alternatively one could use
A.shape[0]
, which should return the same value, however, further down the function the linec[0] = b[0]
pops up. And again, ifb
is not passed as an argument, it is undefined (or ill-defined) in this context.So, the full changes for this to work are:
solve_tridiag_linear_system
changec, d = factorize_tridiag_matrix(A)
toc, d = factorize_tridiag_matrix(A, b)
factorize_tridiag_matrix
changedef factorize_tridiag_matrix(A):
todef factorize_tridiag_matrix(A, b):
Best regards