def refresh(self): """ Re-generate linear matrices Used for parameter sweeps """ self.Gll = pysparse.spmatrix.ll_mat(self.ckt.nD_dimension, self.ckt.nD_dimension) # Generate G matrix (never changes) for elem in self.ckt.nD_elemList: # All elements have nD_linVCCS (perhaps empty) for vccs in elem.nD_linVCCS: set_quad(self.Gll, *vccs) # Frequency-defined elements for elem in self.ckt.nD_freqDefinedElem: set_Jac(self.Gll, elem.nD_fpos, elem.nD_fneg, elem.nD_fpos, elem.nD_fneg, elem.get_G_matrix()) # Free unused memory self.Gll.compress() # Create G in csr form for efficient matrix-vector multiplication self.G = self.Gll.to_csr()
def refresh(self): """ Re-generate linear matrices Used for parametric sweeps """ self.Gll.scale(0.) self.Cll.scale(0.) # Generate G matrix (never changes) for elem in self.ckt.nD_elemList: # All elements have nD_linVCCS (perhaps empty) for vccs in elem.nD_linVCCS: set_quad(self.Gll, *vccs) for vccs in elem.nD_linVCQS: set_quad(self.Cll, *vccs) # # Frequency-defined elements not included for now # for elem in self.ckt.nD_freqDefinedElem: # set_Jac(self.G, elem.nD_fpos, elem.nD_fneg, # elem.nD_fpos, elem.nD_fneg, elem.get_G_matrix()) self.Gll.compress() self.Cll.compress() self.C = self.Cll.to_csr()