aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-04-14 08:20:24 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-04-14 08:20:24 +0000
commitea3ccb1e8c278a7a59a6b802d00b9050f9d5358b (patch)
tree4bb85eb170764b786ae8b33387f913d9c4a75e98 /doc
parentab4046970bd4e7772287ef882334b8be26ea86da (diff)
* Start of the LU module, with matrix inversion already there and
fully optimized. * Even if LargeBit is set, only parallelize for large enough objects (controlled by EIGEN_PARALLELIZATION_TRESHOLD).
Diffstat (limited to 'doc')
-rw-r--r--doc/echelon.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/doc/echelon.cpp b/doc/echelon.cpp
index 04b1907cd..3c9e58e59 100644
--- a/doc/echelon.cpp
+++ b/doc/echelon.cpp
@@ -49,7 +49,7 @@ struct unroll_echelon<Derived, Dynamic>
{
static void run(MatrixBase<Derived>& m)
{
- for(int k = 0; k < m.diagonal().size(); k++)
+ for(int k = 0; k < m.diagonal().size() - 1; k++)
{
int rowOfBiggest, colOfBiggest;
int cornerRows = m.rows()-k, cornerCols = m.cols()-k;
@@ -63,13 +63,14 @@ struct unroll_echelon<Derived, Dynamic>
}
}
};
+
using namespace std;
template<typename Derived>
void echelon(MatrixBase<Derived>& m)
{
const int size = DiagonalCoeffs<Derived>::SizeAtCompileTime;
const bool unroll = size <= 4;
- unroll_echelon<Derived, unroll ? size : Dynamic>::run(m);
+ unroll_echelon<Derived, unroll ? size-1 : Dynamic>::run(m);
}
template<typename Derived>
@@ -100,7 +101,7 @@ using namespace std;
int main(int, char **)
{
srand((unsigned int)time(0));
- const int Rows = 6, Cols = 6;
+ const int Rows = 6, Cols = 4;
typedef Matrix<double, Rows, Cols> Mat;
const int N = Rows < Cols ? Rows : Cols;