Symbolic and numeric update on a whole panel

This commit is contained in:
Desire NUENTSA
2012-05-29 17:55:38 +02:00
parent b6267507ea
commit 8ab820b5b8
4 changed files with 221 additions and 19 deletions

View File

@@ -46,12 +46,12 @@
#define SPARSELU_SNODE_BMOD_H
template <typename VectorType>
int SparseLU::LU_dsnode_bmod (const int jcol, const int jsupno, const int fsupc,
VectorType& dense, VectorType& tempv)
VectorType& dense, VectorType& tempv, LU_GlobalLu_t& Glu)
{
VectorXi& lsub = m_Glu.lsub; // Compressed row subscripts of ( rectangular supernodes ??)
VectorXi& xlsub = m_Glu.xlsub; // xlsub[j] is the starting location of the j-th column in lsub(*)
Scalar* lusup = m_Glu.lusup.data(); // Numerical values of the rectangular supernodes
VectorXi& xlusup = m_Glu.xlusup; // xlusup[j] is the starting location of the j-th column in lusup(*)
VectorXi& lsub = Glu.lsub; // Compressed row subscripts of ( rectangular supernodes ??)
VectorXi& xlsub = Glu.xlsub; // xlsub[j] is the starting location of the j-th column in lsub(*)
VectorType& lusup = Glu.lusup; // Numerical values of the rectangular supernodes
VectorXi& xlusup = Glu.xlusup; // xlusup[j] is the starting location of the j-th column in lusup(*)
int nextlu = xlusup(jcol); // Starting location of the next column to add
int irow;
@@ -72,16 +72,20 @@ int SparseLU::LU_dsnode_bmod (const int jcol, const int jsupno, const int fsupc,
int ufirst = xlusup(jcol); // points to the beginning of column jcol in supernode L\U(jsupno)
int nrow = nsupr - nsupc; // Number of rows in the off-diagonal blocks
int incx = 1, incy = 1;
Scalar alpha = Scalar(-1.0);
Scalar beta = Scalar(1.0);
// int incx = 1, incy = 1;
// Scalar alpha = Scalar(-1.0);
// Scalar beta = Scalar(1.0);
// Solve the triangular system for U(fsupc:jcol, jcol) with L(fspuc..., fsupc:jcol)
//BLASFUNC(trsv)("L", "N", "U", &nsupc, &(lusup[luptr]), &nsupr, &(lusup[ufirst]), &incx);
Map<Matrix<Scalar,Dynamic,Dynamic>, 0, OuterStride<> > A( &(lusup[luptr]), nsupc, nsupc, OuterStride<>(nsupr) );
Map<Matrix<Scalar,Dynamic,1> > l(&(lusup[ufirst]), nsupc);
Map<Matrix<Scalar,Dynamic,Dynamic>, 0, OuterStride<> > A( &(lusup.data()[luptr]), nsupc, nsupc, OuterStride<>(nsupr) );
Map<Matrix<Scalar,Dynamic,1> > l(&(lusup.data()[ufirst]), nsupc);
l = A.triangularView<Lower>().solve(l);
// Update the trailing part of the column jcol U(jcol:jcol+nrow, jcol) using L(jcol:jcol+nrow, fsupc:jcol) and U(fsupc:jcol)
BLASFUNC(gemv)("N", &nrow, &nsupc, &alpha, &lusup[luptr+nsupc], &nsupr, &lusup[ufirst], &incx, &beta, &lusup[ufirst+nsupc], &incy);
Map<Matrix<Scalar,Dynamic,1> > u(&(lusup.data()[ufirst+nsupc], nsupc);
u = A * l;
// BLASFUNC(gemv)("N", &nrow, &nsupc, &alpha, &lusup[luptr+nsupc], &nsupr, &lusup[ufirst], &incx, &beta, &lusup[ufirst+nsupc], &incy);
return 0;
}