scitools icon indicating copy to clipboard operation
scitools copied to clipboard

factorize_tridiag_matrix asking for len(b) [and proposed solution]

Open berna1111 opened this issue 10 years ago • 0 comments

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):

Best regards

berna1111 avatar Jun 09 '15 09:06 berna1111