X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Fldlt.py;fp=mjo%2Fldlt.py;h=c8483c707afa6f3b67935e451b7c979401661b09;hb=78a924d7f6b518daa3886b3356ae9a4af86ebee1;hp=6b9908341add2dfaadb99c17a76dc7c4c19913dc;hpb=a2334e928c769d00d59ae43e2cad8abd61389066;p=sage.d.git diff --git a/mjo/ldlt.py b/mjo/ldlt.py index 6b99083..c8483c7 100644 --- a/mjo/ldlt.py +++ b/mjo/ldlt.py @@ -409,28 +409,28 @@ def block_ldlt(A): p[k] = p[s] p[s] = p_k - # Now the pivot is in the (k,k)th position. - d.append( matrix(ring, 1, [[A[k,k]]]) ) - - # Compute the Schur complement that we'll work on during - # the following iteration, and store it back in the lower- - # right-hand corner of "A". - for i in range(n-k-1): - for j in range(i+1): - A[k+1+j,k+1+i] = ( A[k+1+j,k+1+i] - - A[k,k+1+j]*A[k,k+1+i]/alpha ) - A[k+1+i,k+1+j] = A[k+1+j,k+1+i] # keep it symmetric! - - for i in range(n-k-1): - # Store the new (kth) column of "L" within the lower- - # left-hand corner of "A", being sure to set the lower- - # left entries from the upper-right ones to avoid - #collisions. - A[k+i+1,k] = A[k,k+1+i]/alpha - - # No return value, only the desired side effects of updating - # p, d, and A. - return + # Now the pivot is in the (k,k)th position. + d.append( matrix(ring, 1, [[A[k,k]]]) ) + + # Compute the Schur complement that we'll work on during + # the following iteration, and store it back in the lower- + # right-hand corner of "A". + for i in range(n-k-1): + for j in range(i+1): + A[k+1+j,k+1+i] = ( A[k+1+j,k+1+i] - + A[k,k+1+j]*A[k,k+1+i]/A[k,k] ) + A[k+1+i,k+1+j] = A[k+1+j,k+1+i] # keep it symmetric! + + for i in range(n-k-1): + # Store the new (kth) column of "L" within the lower- + # left-hand corner of "A", being sure to set the lower- + # left entries from the upper-right ones to avoid + # collisions. + A[k+i+1,k] = A[k,k+1+i]/A[k,k] + + # No return value, only the desired side effects of updating + # p, d, and A. + return k = 0 while k < n: