Go to the documentation of this file.
10 #ifndef EIGEN_COMPANION_H
11 #define EIGEN_COMPANION_H
21 #ifndef EIGEN_PARSED_BY_DOXYGEN
27 T
radix2(){
return radix<T>()*radix<T>(); }
38 template<
typename _Scalar,
int _Deg >
74 template<
typename VectorType>
77 const Index deg = poly.size()-1;
78 m_monic = -1/poly[deg] * poly.head(deg);
83 template<
typename VectorType>
91 const Index deg_1 = deg-1;
95 << LeftBlockFirstRow::Zero(1,deg_1),
96 BottomLeftBlock::Identity(deg-1,deg-1)*
m_bl_diag.asDiagonal() ).finished()
140 template<
typename _Scalar,
int _Deg >
145 if(
Scalar(0) == colNorm ||
Scalar(0) == rowNorm ){
return true; }
153 rowB = rowNorm / radix<Scalar>();
155 const Scalar s = colNorm + rowNorm;
157 while (colNorm < rowB)
159 colB *= radix<Scalar>();
160 colNorm *= radix2<Scalar>();
163 rowB = rowNorm * radix<Scalar>();
165 while (colNorm >= rowB)
167 colB /= radix<Scalar>();
168 colNorm /= radix2<Scalar>();
172 if ((rowNorm + colNorm) <
Scalar(0.95) *
s * colB)
183 template<
typename _Scalar,
int _Deg >
188 if(
Scalar(0) == colNorm ||
Scalar(0) == rowNorm ){
return true; }
195 const _Scalar
q = colNorm/rowNorm;
198 rowB =
sqrt( colNorm/rowNorm );
210 template<
typename _Scalar,
int _Deg >
215 const Index deg = m_monic.size();
216 const Index deg_1 = deg-1;
218 bool hasConverged=
false;
219 while( !hasConverged )
227 colNorm =
abs(m_bl_diag[0]);
228 rowNorm =
abs(m_monic[0]);
231 if( !balanced( colNorm, rowNorm, hasConverged, colB, rowB ) )
233 m_bl_diag[0] *= colB;
239 for(
Index i=1; i<deg_1; ++i )
242 colNorm =
abs(m_bl_diag[i]);
245 rowNorm =
abs(m_bl_diag[i-1]) +
abs(m_monic[i]);
248 if( !balanced( colNorm, rowNorm, hasConverged, colB, rowB ) )
250 m_bl_diag[i] *= colB;
251 m_bl_diag[i-1] *= rowB;
258 const Index ebl = m_bl_diag.size()-1;
260 colNorm = headMonic.array().abs().sum();
261 rowNorm =
abs( m_bl_diag[ebl] );
264 if( !balanced( colNorm, rowNorm, hasConverged, colB, rowB ) )
267 m_bl_diag[ebl] *= rowB;
276 #endif // EIGEN_COMPANION_H
NumTraits< Scalar >::Real RealScalar
const EIGEN_DEVICE_FUNC SqrtReturnType sqrt() const
bool balancedR(Scalar colNorm, Scalar rowNorm, bool &isBalanced, Scalar &colB, Scalar &rowB)
companion(const VectorType &poly)
EIGEN_DEVICE_FUNC ColXpr col(Index i)
This is the const version of col().
EIGEN_DEVICE_FUNC bool isApprox(const Scalar &x, const Scalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
DenseCompanionMatrixType denseMatrix() const
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE AbsReturnType abs() const
EIGEN_DEVICE_FUNC const Scalar & q
EIGEN_DEVICE_FUNC Derived & setOnes(Index size)
Matrix< Scalar, 1, Deg_1 > LeftBlockFirstRow
BottomLeftDiagonal m_bl_diag
Matrix< Scalar, Deg, 1 > RightColumn
EIGEN_DEVICE_FUNC RowXpr row(Index i)
This is the const version of row(). */.
#define EIGEN_STRONG_INLINE
Matrix< Scalar, Deg_1, Deg_1 > BottomLeftBlock
bool balanced(Scalar colNorm, Scalar rowNorm, bool &isBalanced, Scalar &colB, Scalar &rowB)
Matrix< Scalar, _Deg, Deg_1 > LeftBlock
Matrix< Scalar, Deg, Deg > DenseCompanionMatrixType
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
Matrix< Scalar, Deg_1, 1 > BottomLeftDiagonal
Expression of a fixed-size or dynamic-size sub-vector.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rows() const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(Scalar, Size)
const EIGEN_STRONG_INLINE _Scalar operator()(Index row, Index col) const
void setPolynomial(const VectorType &poly)
control_box_rst
Author(s): Christoph Rösmann
autogenerated on Wed Mar 2 2022 00:05:39