]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/ldlt.py: switch some row/column indexing around.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 4 Oct 2020 12:53:48 +0000 (08:53 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 4 Oct 2020 12:53:48 +0000 (08:53 -0400)
mjo/ldlt.py

index 9a6070d1fadf7e66663336cd35af96b8adf2d30e..09b3bb008263281e9cc787764972bb14d40392e4 100644 (file)
@@ -434,9 +434,9 @@ def block_ldlt(A):
         # 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!
+                A[k+1+i,k+1+j] = ( A[k+1+i,k+1+j] -
+                                   A[k,k+1+i]*A[k,k+1+j]/A[k,k] )
+                A[k+1+j,k+1+i] = A[k+1+i,k+1+j] # keep it symmetric!
 
         for i in range(n-k-1):
             # Store the new (kth) column of "L" within the lower-
@@ -554,8 +554,8 @@ def block_ldlt(A):
         # right-hand corner of "A".
         for i in range(n-k-2):
             for j in range(i+1):
+                A[k+2+i,k+2+j] = A[k+2+i,k+2+j] - schur_complement[i,j]
                 A[k+2+j,k+2+i] = A[k+2+j,k+2+i] - schur_complement[j,i]
-                A[k+2+i,k+2+j] = A[k+2+j,k+2+i] # keep it symmetric!
 
         # The on- and above-diagonal entries of "L" will be fixed
         # later, so we only need to worry about the lower-left entry