Hi Riccardo, 2009/5/14 Riccardo Gori <goricca...@gmail.com>: >> + # back substitution to solve R*x = y: >> + # We build up the result "backwards" in the vector 'x' and reverse >> it + # only in the end. >> + x = [] >> + n = R.lines >> + for j in range(n-1, -1, -1): >> + tmp = y[j,:] > > Why do you use y[j,:] instead of y[j]?
The right hand side can be matrix. This can be used, for example, to invert A by using the identity matrix for b. In these cases, y = Q^T b is also a matrix of the same dimension and we need the j-th row of this matrix. Thus y[j,:]. Luckily the same notation works even if b and y are just vectors, so we don't need to write two versions of the code. All the best, Jochen -- http://seehuhn.de/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy-patches" group. To post to this group, send email to sympy-patches@googlegroups.com To unsubscribe from this group, send email to sympy-patches+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy-patches?hl=en -~----------~----~----~----~------~----~------~--~---