Merged in advanpix/eigen-mp-devs (pull request PR-31)

Added support for custom scalars in SparseLU
This commit is contained in:
Gael Guennebaud 2013-08-20 12:10:38 +02:00
commit 2cf513e973
2 changed files with 8 additions and 4 deletions

View File

@ -267,7 +267,8 @@ class SparseLU : public internal::SparseLUImpl<typename _MatrixType::Scalar, typ
if(it.row() < j) continue; if(it.row() < j) continue;
if(it.row() == j) if(it.row() == j)
{ {
det *= (std::abs)(it.value()); using std::abs;
det *= abs(it.value());
break; break;
} }
} }
@ -294,7 +295,8 @@ class SparseLU : public internal::SparseLUImpl<typename _MatrixType::Scalar, typ
if(it.row() < j) continue; if(it.row() < j) continue;
if(it.row() == j) if(it.row() == j)
{ {
det += (std::log)((std::abs)(it.value())); using std::log, std::abs;
det += log(abs(it.value()));
break; break;
} }
} }

View File

@ -77,7 +77,8 @@ Index SparseLUImpl<Scalar,Index>::pivotL(const Index jcol, const RealScalar& dia
RealScalar rtemp; RealScalar rtemp;
Index isub, icol, itemp, k; Index isub, icol, itemp, k;
for (isub = nsupc; isub < nsupr; ++isub) { for (isub = nsupc; isub < nsupr; ++isub) {
rtemp = std::abs(lu_col_ptr[isub]); using std::abs;
rtemp = abs(lu_col_ptr[isub]);
if (rtemp > pivmax) { if (rtemp > pivmax) {
pivmax = rtemp; pivmax = rtemp;
pivptr = isub; pivptr = isub;
@ -101,7 +102,8 @@ Index SparseLUImpl<Scalar,Index>::pivotL(const Index jcol, const RealScalar& dia
if (diag >= 0 ) if (diag >= 0 )
{ {
// Diagonal element exists // Diagonal element exists
rtemp = std::abs(lu_col_ptr[diag]); using std::abs;
rtemp = abs(lu_col_ptr[diag]);
if (rtemp != 0.0 && rtemp >= thresh) pivptr = diag; if (rtemp != 0.0 && rtemp >= thresh) pivptr = diag;
} }
pivrow = lsub_ptr[pivptr]; pivrow = lsub_ptr[pivptr];