aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Householder/HouseholderSequence.h
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2010-01-15 00:35:26 -0500
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2010-01-15 00:35:26 -0500
commitbfe6fdde2488c67ac8de01603d20167c61a788f2 (patch)
tree86b3d8250ff5bc707dc3761404d4ea4c575cbe00 /Eigen/src/Householder/HouseholderSequence.h
parentddc32adb0e9b8683a5070bc78c1a1250d9313e85 (diff)
allow to multiply a householder sequence and a matrix when one is real and one is complex.
This is especially important as in bidiagonalization, the band matrix is real.
Diffstat (limited to 'Eigen/src/Householder/HouseholderSequence.h')
-rw-r--r--Eigen/src/Householder/HouseholderSequence.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/Eigen/src/Householder/HouseholderSequence.h b/Eigen/src/Householder/HouseholderSequence.h
index 61a8e8c1d..f8ae4136b 100644
--- a/Eigen/src/Householder/HouseholderSequence.h
+++ b/Eigen/src/Householder/HouseholderSequence.h
@@ -88,13 +88,28 @@ struct ei_hseq_side_dependent_impl<VectorsType, CoeffsType, OnTheRight>
}
};
+template<typename OtherScalarType, typename MatrixType> struct ei_matrix_type_times_scalar_type
+{
+ typedef typename ei_scalar_product_traits<OtherScalarType, typename MatrixType::Scalar>::ReturnType
+ ResultScalar;
+ typedef Matrix<ResultScalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime,
+ 0, MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime> Type;
+};
+
template<typename VectorsType, typename CoeffsType, int Side> class HouseholderSequence
: public AnyMatrixBase<HouseholderSequence<VectorsType,CoeffsType,Side> >
{
- typedef typename VectorsType::Scalar Scalar;
+ enum {
+ RowsAtCompileTime = ei_traits<HouseholderSequence>::RowsAtCompileTime,
+ ColsAtCompileTime = ei_traits<HouseholderSequence>::ColsAtCompileTime,
+ MaxRowsAtCompileTime = ei_traits<HouseholderSequence>::MaxRowsAtCompileTime,
+ MaxColsAtCompileTime = ei_traits<HouseholderSequence>::MaxColsAtCompileTime
+ };
+ typedef typename ei_traits<HouseholderSequence>::Scalar Scalar;
+
typedef typename ei_hseq_side_dependent_impl<VectorsType,CoeffsType,Side>::EssentialVectorType
EssentialVectorType;
-
+
public:
typedef HouseholderSequence<
@@ -179,17 +194,19 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
}
template<typename OtherDerived>
- typename OtherDerived::PlainMatrixType operator*(const MatrixBase<OtherDerived>& other) const
+ typename ei_matrix_type_times_scalar_type<Scalar, OtherDerived>::Type operator*(const MatrixBase<OtherDerived>& other) const
{
- typename OtherDerived::PlainMatrixType res(other);
+ typename ei_matrix_type_times_scalar_type<Scalar, OtherDerived>::Type
+ res(other.template cast<typename ei_matrix_type_times_scalar_type<Scalar, OtherDerived>::ResultScalar>());
applyThisOnTheLeft(res);
return res;
}
template<typename OtherDerived> friend
- typename OtherDerived::PlainMatrixType operator*(const MatrixBase<OtherDerived>& other, const HouseholderSequence& h)
+ typename ei_matrix_type_times_scalar_type<Scalar, OtherDerived>::Type operator*(const MatrixBase<OtherDerived>& other, const HouseholderSequence& h)
{
- typename OtherDerived::PlainMatrixType res(other);
+ typename ei_matrix_type_times_scalar_type<Scalar, OtherDerived>::Type
+ res(other.template cast<typename ei_matrix_type_times_scalar_type<Scalar, OtherDerived>::ResultScalar>());
h.applyThisOnTheRight(res);
return res;
}