aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/LU
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-05-20 16:54:40 +0200
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-05-20 16:54:40 +0200
commitc7baddb132f3c5894775041645f54517bd110d40 (patch)
tree5f231651bcef1c0f67a0b0baeb68f4c2765aa67b /Eigen/src/LU
parentdd45c4805ced4ad8ead743875f42259e9b6a2795 (diff)
add internal comment (mostly a pretext to test the eigen-commits list)
Diffstat (limited to 'Eigen/src/LU')
-rw-r--r--Eigen/src/LU/LU.h9
-rw-r--r--Eigen/src/LU/PartialLU.h6
2 files changed, 14 insertions, 1 deletions
diff --git a/Eigen/src/LU/LU.h b/Eigen/src/LU/LU.h
index 32525ebc3..e6333b990 100644
--- a/Eigen/src/LU/LU.h
+++ b/Eigen/src/LU/LU.h
@@ -383,9 +383,16 @@ LU<MatrixType>::LU(const MatrixType& matrix)
}
if(k<rows-1)
m_lu.col(k).end(rows-k-1) /= m_lu.coeff(k,k);
- if(k<size-1)
+ if(k<size-1) {
+ /* I know it's tempting to replace this for loop by a single matrix product. But actually there's no reason why it
+ * should be faster because it's just an exterior vector product; and in practice this gives much slower code with
+ * GCC 4.2-4.4 (this is weird, would be interesting to investigate). On the other hand, it would be worth having a variant
+ * for row-major matrices, traversing in the other direction for better performance, with a meta selector to compile only
+ * one path
+ */
for(int col = k + 1; col < cols; ++col)
m_lu.col(col).end(rows-k-1) -= m_lu.col(k).end(rows-k-1) * m_lu.coeff(k,col);
+ }
}
for(int k = 0; k < matrix.rows(); ++k) m_p.coeffRef(k) = k;
diff --git a/Eigen/src/LU/PartialLU.h b/Eigen/src/LU/PartialLU.h
index 3a6e9f286..7ca4f4f51 100644
--- a/Eigen/src/LU/PartialLU.h
+++ b/Eigen/src/LU/PartialLU.h
@@ -197,6 +197,12 @@ PartialLU<MatrixType>::PartialLU(const MatrixType& matrix)
if(k<size-1) {
m_lu.col(k).end(size-k-1) /= m_lu.coeff(k,k);
+ /* I know it's tempting to replace this for loop by a single matrix product. But actually there's no reason why it
+ * should be faster because it's just an exterior vector product; and in practice this gives much slower code with
+ * GCC 4.2-4.4 (this is weird, would be interesting to investigate). On the other hand, it would be worth having a variant
+ * for row-major matrices, traversing in the other direction for better performance, with a meta selector to compile only
+ * one path
+ */
for(int col = k + 1; col < size; ++col)
m_lu.col(col).end(size-k-1) -= m_lu.col(k).end(size-k-1) * m_lu.coeff(k,col);
}