scitools
scitools copied to clipboard
factorize_tridiag_matrix asking for len(b) [and proposed solution]
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_systemchangec, d = factorize_tridiag_matrix(A)toc, d = factorize_tridiag_matrix(A, b) - in
factorize_tridiag_matrixchangedef factorize_tridiag_matrix(A):todef factorize_tridiag_matrix(A, b):
Best regards