mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-13 16:41:50 +08:00
port sparse LLT/LDLT to new stack allocation API
(transplanted from 535a61ede88e460f53afae26dc4b583b0dede0ad )
This commit is contained in:
parent
19e7c672bb
commit
adf5992767
@ -295,7 +295,7 @@ void SimplicialCholesky<_MatrixType,_UpLo>::analyzePattern(const MatrixType& a)
|
|||||||
m_parent.resize(size);
|
m_parent.resize(size);
|
||||||
m_nonZerosPerCol.resize(size);
|
m_nonZerosPerCol.resize(size);
|
||||||
|
|
||||||
Index* tags = ei_aligned_stack_new(Index, size);
|
ei_declare_aligned_stack_constructed_variable(Index, tags, size, 0);
|
||||||
|
|
||||||
// TODO allows to configure the permutation
|
// TODO allows to configure the permutation
|
||||||
{
|
{
|
||||||
@ -338,9 +338,6 @@ void SimplicialCholesky<_MatrixType,_UpLo>::analyzePattern(const MatrixType& a)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// release workspace
|
|
||||||
ei_aligned_stack_delete(Index, tags, size);
|
|
||||||
|
|
||||||
/* construct Lp index array from m_nonZerosPerCol column counts */
|
/* construct Lp index array from m_nonZerosPerCol column counts */
|
||||||
Index* Lp = m_matrix._outerIndexPtr();
|
Index* Lp = m_matrix._outerIndexPtr();
|
||||||
Lp[0] = 0;
|
Lp[0] = 0;
|
||||||
@ -369,9 +366,9 @@ void SimplicialCholesky<_MatrixType,_UpLo>::factorize(const MatrixType& a)
|
|||||||
Index* Li = m_matrix._innerIndexPtr();
|
Index* Li = m_matrix._innerIndexPtr();
|
||||||
Scalar* Lx = m_matrix._valuePtr();
|
Scalar* Lx = m_matrix._valuePtr();
|
||||||
|
|
||||||
Scalar* y = ei_aligned_stack_new(Scalar, size);
|
ei_declare_aligned_stack_constructed_variable(Scalar, y, size, 0);
|
||||||
Index* pattern = ei_aligned_stack_new(Index, size);
|
ei_declare_aligned_stack_constructed_variable(Index, pattern, size, 0);
|
||||||
Index* tags = ei_aligned_stack_new(Index, size);
|
ei_declare_aligned_stack_constructed_variable(Index, tags, size, 0);
|
||||||
|
|
||||||
SparseMatrix<Scalar,ColMajor,Index> ap(size,size);
|
SparseMatrix<Scalar,ColMajor,Index> ap(size,size);
|
||||||
ap.template selfadjointView<Upper>() = a.template selfadjointView<UpLo>().twistedBy(m_Pinv);
|
ap.template selfadjointView<Upper>() = a.template selfadjointView<UpLo>().twistedBy(m_Pinv);
|
||||||
@ -443,11 +440,6 @@ void SimplicialCholesky<_MatrixType,_UpLo>::factorize(const MatrixType& a)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// release workspace
|
|
||||||
ei_aligned_stack_delete(Scalar, y, size);
|
|
||||||
ei_aligned_stack_delete(Index, pattern, size);
|
|
||||||
ei_aligned_stack_delete(Index, tags, size);
|
|
||||||
|
|
||||||
m_info = ok ? Success : NumericalIssue;
|
m_info = ok ? Success : NumericalIssue;
|
||||||
m_factorizationIsOk = true;
|
m_factorizationIsOk = true;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,8 @@ void SparseLDLT<_MatrixType,Backend>::_symbolic(const _MatrixType& a)
|
|||||||
m_matrix.resize(size, size);
|
m_matrix.resize(size, size);
|
||||||
m_parent.resize(size);
|
m_parent.resize(size);
|
||||||
m_nonZerosPerCol.resize(size);
|
m_nonZerosPerCol.resize(size);
|
||||||
Index * tags = ei_aligned_stack_new(Index, size);
|
|
||||||
|
ei_declare_aligned_stack_constructed_variable(Index, tags, size, 0);
|
||||||
|
|
||||||
const Index* Ap = a._outerIndexPtr();
|
const Index* Ap = a._outerIndexPtr();
|
||||||
const Index* Ai = a._innerIndexPtr();
|
const Index* Ai = a._innerIndexPtr();
|
||||||
@ -298,7 +299,6 @@ void SparseLDLT<_MatrixType,Backend>::_symbolic(const _MatrixType& a)
|
|||||||
Lp[k+1] = Lp[k] + m_nonZerosPerCol[k];
|
Lp[k+1] = Lp[k] + m_nonZerosPerCol[k];
|
||||||
|
|
||||||
m_matrix.resizeNonZeros(Lp[size]);
|
m_matrix.resizeNonZeros(Lp[size]);
|
||||||
ei_aligned_stack_delete(Index, tags, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _MatrixType, typename Backend>
|
template<typename _MatrixType, typename Backend>
|
||||||
@ -317,9 +317,9 @@ bool SparseLDLT<_MatrixType,Backend>::_numeric(const _MatrixType& a)
|
|||||||
Scalar* Lx = m_matrix._valuePtr();
|
Scalar* Lx = m_matrix._valuePtr();
|
||||||
m_diag.resize(size);
|
m_diag.resize(size);
|
||||||
|
|
||||||
Scalar * y = ei_aligned_stack_new(Scalar, size);
|
ei_declare_aligned_stack_constructed_variable(Scalar, y, size, 0);
|
||||||
Index * pattern = ei_aligned_stack_new(Index, size);
|
ei_declare_aligned_stack_constructed_variable(Index, pattern, size, 0);
|
||||||
Index * tags = ei_aligned_stack_new(Index, size);
|
ei_declare_aligned_stack_constructed_variable(Index, tags, size, 0);
|
||||||
|
|
||||||
Index* P = 0;
|
Index* P = 0;
|
||||||
Index* Pinv = 0;
|
Index* Pinv = 0;
|
||||||
@ -383,10 +383,6 @@ bool SparseLDLT<_MatrixType,Backend>::_numeric(const _MatrixType& a)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ei_aligned_stack_delete(Scalar, y, size);
|
|
||||||
ei_aligned_stack_delete(Index, pattern, size);
|
|
||||||
ei_aligned_stack_delete(Index, tags, size);
|
|
||||||
|
|
||||||
return ok; /* success, diagonal of D is all nonzero */
|
return ok; /* success, diagonal of D is all nonzero */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user