(self)
return L, D
Algorithm for numeric LDL factization, exploiting sparse structure.
Algorithm for numeric LDL factization, exploiting sparse structure.
Algorithm for numeric LDL factization exploiting sparse structure .
def _LDL_sparse(self):
        """Algorithm for numeric LDL factization, exploiting sparse structure.
        """
        Lrowstruc = self.row_structure_symbolic_cholesky()
        L = self.eye(self.rows)
        D = self.zeros(self.rows, self.cols)

        for i in range(len(Lrowstruc)):
            for j in Lrowstruc[i]:
                if i != j:
                    L[i, j] = self[i, j]
                    summ = 0
                    for p1 in Lrowstruc[i]:
                        if p1 < j:
                            for p2 in Lrowstruc[j]:
                                if p2 < j:
                                    if p1 == p2:
                                        summ += L[i, p1]*L[j, p1]*D[p1, p1]
                                else:
                                    break
                        else:
                            break
                    L[i, j] -= summ
                    L[i, j] /= D[j, j]
                elif i == j:
                    D[i, i] = self[i, i]
                    summ = 0
                    for k in Lrowstruc[i]:
                        if k < i:
                            summ += L[i, k]**2*D[k, k]
                        else:
                            break
                    D[i, i] -= summ

        return L, D
def _LDL_sparse ( self ) : Lrowstruc = self . row_structure_symbolic_cholesky ( ) L = self . eye ( self . rows ) D = self . zeros ( self . rows , self . cols ) for i in range ( len ( Lrowstruc ) ) : for j in Lrowstruc [ i ] : if i != j : L [ i , j ] = self [ i , j ] summ = 0 for p1 in Lrowstruc [ i ] : if p1 < j : for p2 in Lrowstruc [ j ] : if p2 < j : if p1 == p2 : summ += L [ i , p1 ] * L [ j , p1 ] * D [ p1 , p1 ] else : break else : break L [ i , j ] -= summ L [ i , j ] /= D [ j , j ] elif i == j : D [ i , i ] = self [ i , i ] summ = 0 for k in Lrowstruc [ i ] : if k < i : summ += L [ i , k ] ** 2 * D [ k , k ] else : break D [ i , i ] -= summ return L , D