Squashed 'third_party/eigen/' changes from 61d72f6..cf794d3
Change-Id: I9b814151b01f49af6337a8605d0c42a3a1ed4c72
git-subtree-dir: third_party/eigen
git-subtree-split: cf794d3b741a6278df169e58461f8529f43bce5d
diff --git a/unsupported/Eigen/src/Polynomials/CMakeLists.txt b/unsupported/Eigen/src/Polynomials/CMakeLists.txt
deleted file mode 100644
index 51f13f3..0000000
--- a/unsupported/Eigen/src/Polynomials/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-FILE(GLOB Eigen_Polynomials_SRCS "*.h")
-
-INSTALL(FILES
- ${Eigen_Polynomials_SRCS}
- DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/Polynomials COMPONENT Devel
- )
diff --git a/unsupported/Eigen/src/Polynomials/PolynomialSolver.h b/unsupported/Eigen/src/Polynomials/PolynomialSolver.h
index cd5c04b..03198ec 100644
--- a/unsupported/Eigen/src/Polynomials/PolynomialSolver.h
+++ b/unsupported/Eigen/src/Polynomials/PolynomialSolver.h
@@ -41,7 +41,7 @@
protected:
template< typename OtherPolynomial >
inline void setPolynomial( const OtherPolynomial& poly ){
- m_roots.resize(poly.size()); }
+ m_roots.resize(poly.size()-1); }
public:
template< typename OtherPolynomial >
@@ -316,7 +316,7 @@
* - real roots with greatest, smallest absolute real value.
* - greatest, smallest real roots.
*
- * WARNING: this polynomial solver is experimental, part of the unsuported Eigen modules.
+ * WARNING: this polynomial solver is experimental, part of the unsupported Eigen modules.
*
*
* Currently a QR algorithm is used to compute the eigenvalues of the companion matrix of
@@ -345,10 +345,19 @@
void compute( const OtherPolynomial& poly )
{
eigen_assert( Scalar(0) != poly[poly.size()-1] );
- internal::companion<Scalar,_Deg> companion( poly );
- companion.balance();
- m_eigenSolver.compute( companion.denseMatrix() );
- m_roots = m_eigenSolver.eigenvalues();
+ eigen_assert( poly.size() > 1 );
+ if(poly.size() > 2 )
+ {
+ internal::companion<Scalar,_Deg> companion( poly );
+ companion.balance();
+ m_eigenSolver.compute( companion.denseMatrix() );
+ m_roots = m_eigenSolver.eigenvalues();
+ }
+ else if(poly.size () == 2)
+ {
+ m_roots.resize(1);
+ m_roots[0] = -poly[0]/poly[1];
+ }
}
public:
@@ -376,10 +385,18 @@
template< typename OtherPolynomial >
void compute( const OtherPolynomial& poly )
{
- eigen_assert( Scalar(0) != poly[poly.size()-1] );
- m_roots[0] = -poly[0]/poly[poly.size()-1];
+ eigen_assert( poly.size() == 2 );
+ eigen_assert( Scalar(0) != poly[1] );
+ m_roots[0] = -poly[0]/poly[1];
}
+ public:
+ template< typename OtherPolynomial >
+ inline PolynomialSolver( const OtherPolynomial& poly ){
+ compute( poly ); }
+
+ inline PolynomialSolver(){}
+
protected:
using PS_Base::m_roots;
};
diff --git a/unsupported/Eigen/src/Polynomials/PolynomialUtils.h b/unsupported/Eigen/src/Polynomials/PolynomialUtils.h
index 2bb8bc8..394e857 100644
--- a/unsupported/Eigen/src/Polynomials/PolynomialUtils.h
+++ b/unsupported/Eigen/src/Polynomials/PolynomialUtils.h
@@ -20,8 +20,8 @@
* e.g. \f$ 1 + 3x^2 \f$ is stored as a vector \f$ [ 1, 0, 3 ] \f$.
* \param[in] x : the value to evaluate the polynomial at.
*
- * <i><b>Note for stability:</b></i>
- * <dd> \f$ |x| \le 1 \f$ </dd>
+ * \note for stability:
+ * \f$ |x| \le 1 \f$
*/
template <typename Polynomials, typename T>
inline
@@ -56,7 +56,7 @@
for( DenseIndex i=1; i<poly.size(); ++i ){
val = val*inv_x + poly[i]; }
- return std::pow(x,(T)(poly.size()-1)) * val;
+ return numext::pow(x,(T)(poly.size()-1)) * val;
}
}
@@ -67,8 +67,8 @@
* by degrees i.e. poly[i] is the coefficient of degree i of the polynomial
* e.g. \f$ 1 + 3x^2 \f$ is stored as a vector \f$ [ 1, 0, 3 ] \f$.
*
- * <i><b>Precondition:</b></i>
- * <dd> the leading coefficient of the input polynomial poly must be non zero </dd>
+ * \pre
+ * the leading coefficient of the input polynomial poly must be non zero
*/
template <typename Polynomial>
inline