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: