Skip to content

Commit

Permalink
Save intermediate matrices.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuihantao committed Mar 25, 2024
1 parent 127dc46 commit 4f533a0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions andes/routines/eig.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,18 @@ def _reduce(self, fx, fy, gx, gy, Tf, dense=True):
spmatrix
The reduced state matrix
"""
gyx = matrix(gx)
self.solver.linsolve(gy, gyx)
self.gyx = matrix(gx)
self.solver.linsolve(gy, self.gyx)

Tfnz = Tf + np.ones_like(Tf) * np.equal(Tf, 0.0)
iTf = spdiag((1 / Tfnz).tolist())

self.fxy = (fx - fy * self.gyx)

if dense:
return iTf * (fx - fy * gyx)
return iTf * self.fxy
else:
return sparse(iTf * (fx - fy * gyx))
return sparse(iTf * self.fxy)

def _reorder(self):
"""
Expand Down

0 comments on commit 4f533a0

Please sign in to comment.