aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-03-05 13:18:19 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-03-05 13:18:19 +0000
commit8e0d548039f260db2eacb1e54e62e1acdbd4dd09 (patch)
tree24c0b8656e51fbfcbc80e5b73583e55832796eeb /Eigen/src
parent861c6f4c9b4ceff1ad734e22f4615b260b1d9c45 (diff)
* Fix a compilation issue with large fixed-size matrices: the unrollers were always instanciated.
* the unrolling limits are configurable at compile time.
Diffstat (limited to 'Eigen/src')
-rw-r--r--Eigen/src/Core/Dot.h13
-rw-r--r--Eigen/src/Core/MatrixBase.h2
-rw-r--r--Eigen/src/Core/OperatorEquals.h18
-rw-r--r--Eigen/src/Core/Product.h5
-rw-r--r--Eigen/src/Core/Trace.h13
-rw-r--r--Eigen/src/Core/Util.h20
6 files changed, 48 insertions, 23 deletions
diff --git a/Eigen/src/Core/Dot.h b/Eigen/src/Core/Dot.h
index c3ca1e2ac..652514fa3 100644
--- a/Eigen/src/Core/Dot.h
+++ b/Eigen/src/Core/Dot.h
@@ -5,12 +5,12 @@
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
+// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// Alternatively, you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
+// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -18,7 +18,7 @@
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
+// You should have received a copy of the GNU Lesser General Public
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
@@ -60,7 +60,7 @@ struct DotUnroller<Index, 0, Derived1, Derived2>
/** \returns the dot product of *this with other.
*
* \only_for_vectors
- *
+ *
* \note If the scalar type is complex numbers, then this function returns the hermitian
* (sesquilinear) dot product, linear in the first variable and anti-linear in the
* second variable.
@@ -77,8 +77,9 @@ Scalar MatrixBase<Scalar, Derived>::dot(const MatrixBase<Scalar, OtherDerived>&
Scalar res;
if(EIGEN_UNROLLED_LOOPS
&& Traits::SizeAtCompileTime != Dynamic
- && Traits::SizeAtCompileTime <= 16)
- DotUnroller<Traits::SizeAtCompileTime-1, Traits::SizeAtCompileTime,
+ && Traits::SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT)
+ DotUnroller<Traits::SizeAtCompileTime-1,
+ Traits::SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT ? Traits::SizeAtCompileTime : Dynamic,
Derived, MatrixBase<Scalar, OtherDerived> >
::run(*static_cast<const Derived*>(this), other, res);
else
diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h
index 09af4bd8d..f5a2ad178 100644
--- a/Eigen/src/Core/MatrixBase.h
+++ b/Eigen/src/Core/MatrixBase.h
@@ -49,6 +49,8 @@
cout << x.row(0) << endl;
}
* \endcode
+ *
+ * \nosubgrouping
*/
template<typename Scalar, typename Derived> class MatrixBase
{
diff --git a/Eigen/src/Core/OperatorEquals.h b/Eigen/src/Core/OperatorEquals.h
index 6ff4402d4..bc1450127 100644
--- a/Eigen/src/Core/OperatorEquals.h
+++ b/Eigen/src/Core/OperatorEquals.h
@@ -6,12 +6,12 @@
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
+// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// Alternatively, you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
+// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -19,7 +19,7 @@
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
+// You should have received a copy of the GNU Lesser General Public
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
@@ -106,9 +106,12 @@ Derived& MatrixBase<Scalar, Derived>
// copying a vector expression into a vector
{
assert(size() == other.size());
- if(EIGEN_UNROLLED_LOOPS && Traits::SizeAtCompileTime != Dynamic && Traits::SizeAtCompileTime <= 25)
+ if(EIGEN_UNROLLED_LOOPS
+ && Traits::SizeAtCompileTime != Dynamic
+ && Traits::SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_OPEQUAL)
VectorOperatorEqualsUnroller
- <Derived, OtherDerived, Traits::SizeAtCompileTime>::run
+ <Derived, OtherDerived,
+ Traits::SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_OPEQUAL ? Traits::SizeAtCompileTime : Dynamic>::run
(*static_cast<Derived*>(this), *static_cast<const OtherDerived*>(&other));
else
for(int i = 0; i < size(); i++)
@@ -120,10 +123,11 @@ Derived& MatrixBase<Scalar, Derived>
assert(rows() == other.rows() && cols() == other.cols());
if(EIGEN_UNROLLED_LOOPS
&& Traits::SizeAtCompileTime != Dynamic
- && Traits::SizeAtCompileTime <= 25)
+ && Traits::SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_OPEQUAL)
{
MatrixOperatorEqualsUnroller
- <Derived, OtherDerived, Traits::SizeAtCompileTime>::run
+ <Derived, OtherDerived,
+ Traits::SizeAtCompileTime <= EIGEN_UNROLLING_LIMIT_OPEQUAL ? Traits::SizeAtCompileTime : Dynamic>::run
(*static_cast<Derived*>(this), *static_cast<const OtherDerived*>(&other));
}
else
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h
index 7ca68d76e..4d2db51bd 100644
--- a/Eigen/src/Core/Product.h
+++ b/Eigen/src/Core/Product.h
@@ -106,9 +106,10 @@ template<typename Lhs, typename Rhs> class Product : NoOperatorEquals,
Scalar res;
if(EIGEN_UNROLLED_LOOPS
&& Lhs::Traits::ColsAtCompileTime != Dynamic
- && Lhs::Traits::ColsAtCompileTime <= 16)
+ && Lhs::Traits::ColsAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT)
ProductUnroller<Lhs::Traits::ColsAtCompileTime-1,
- Lhs::Traits::ColsAtCompileTime, LhsRef, RhsRef>
+ Lhs::Traits::ColsAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT ? Lhs::Traits::ColsAtCompileTime : Dynamic,
+ LhsRef, RhsRef>
::run(row, col, m_lhs, m_rhs, res);
else
{
diff --git a/Eigen/src/Core/Trace.h b/Eigen/src/Core/Trace.h
index 564801221..ff080c595 100644
--- a/Eigen/src/Core/Trace.h
+++ b/Eigen/src/Core/Trace.h
@@ -5,12 +5,12 @@
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
+// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// Alternatively, you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
+// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -18,7 +18,7 @@
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
+// You should have received a copy of the GNU Lesser General Public
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
@@ -61,8 +61,11 @@ Scalar MatrixBase<Scalar, Derived>::trace() const
{
assert(rows() == cols());
Scalar res;
- if(EIGEN_UNROLLED_LOOPS && Traits::RowsAtCompileTime != Dynamic && Traits::RowsAtCompileTime <= 16)
- TraceUnroller<Traits::RowsAtCompileTime-1, Traits::RowsAtCompileTime, Derived>
+ if(EIGEN_UNROLLED_LOOPS
+ && Traits::RowsAtCompileTime != Dynamic
+ && Traits::RowsAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT)
+ TraceUnroller<Traits::RowsAtCompileTime-1,
+ Traits::RowsAtCompileTime <= EIGEN_UNROLLING_LIMIT_PRODUCT ? Traits::RowsAtCompileTime : Dynamic, Derived>
::run(*static_cast<const Derived*>(this), res);
else
{
diff --git a/Eigen/src/Core/Util.h b/Eigen/src/Core/Util.h
index b11c27653..9d0aa07a0 100644
--- a/Eigen/src/Core/Util.h
+++ b/Eigen/src/Core/Util.h
@@ -5,12 +5,12 @@
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
+// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// Alternatively, you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
+// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -18,7 +18,7 @@
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
// GNU General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
+// You should have received a copy of the GNU Lesser General Public
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
@@ -31,6 +31,20 @@
#define EIGEN_UNROLLED_LOOPS (true)
#endif
+/** Defines the maximal loop size (i.e., the matrix size NxM) to enable
+ * meta unrolling of operator=.
+ */
+#ifndef EIGEN_UNROLLING_LIMIT_OPEQUAL
+#define EIGEN_UNROLLING_LIMIT_OPEQUAL 25
+#endif
+
+/** Defines the maximal loop size to enable meta unrolling
+ * of the matrix product, dot product and trace.
+ */
+#ifndef EIGEN_UNROLLING_LIMIT_PRODUCT
+#define EIGEN_UNROLLING_LIMIT_PRODUCT 16
+#endif
+
#ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
#define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER RowMajor
#else