From: Michael Orlitzky Date: Mon, 28 Sep 2020 18:41:12 +0000 (-0400) Subject: mjo/ldlt.py: avoid some intermediate variables in ldlt_fast(). X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=5aa2527f533c75cafe1daf9c030f4f465f0e291f;p=sage.d.git mjo/ldlt.py: avoid some intermediate variables in ldlt_fast(). --- diff --git a/mjo/ldlt.py b/mjo/ldlt.py index d113df3..4561528 100644 --- a/mjo/ldlt.py +++ b/mjo/ldlt.py @@ -195,18 +195,15 @@ def ldlt_fast(A): # Update the "next" block of A that we'll work on during # the following iteration. I think it's faster to get the # entries of a row than a column here? - v = vector(ring, A[k,k+1:n].list()) - b = v.column()*v.row()/alpha for i in range(n-k-1): for j in range(i+1): - # Something goes wrong if I try to access the kth row/column - # of A to save the intermediate "b" here... - A[k+1+i,k+1+j] = A[k+1+i,k+1+j] - b[i,j] + A[k+1+i,k+1+j] = A[k+1+i,k+1+j] - A[k,k+1+i]*A[k,k+1+j]/alpha A[k+1+j,k+1+i] = A[k+1+i,k+1+j] # keep it symmetric! # Store the "new" (kth) column of L. for i in range(n-k-1): - L[k+i+1,k] = v[i]/alpha + # Set the lower-left "half" from the upper-right "half"... + L[k+i+1,k] = A[k,k+1+i]/alpha I = A.matrix_space().identity_matrix() P = matrix.column( I.row(p[j]) for j in range(n) )