Eigen  3.3.3
VectorwiseOp.h
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
00006 //
00007 // This Source Code Form is subject to the terms of the Mozilla
00008 // Public License v. 2.0. If a copy of the MPL was not distributed
00009 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00010 
00011 #ifndef EIGEN_PARTIAL_REDUX_H
00012 #define EIGEN_PARTIAL_REDUX_H
00013 
00014 namespace Eigen {
00015 
00032 template< typename MatrixType, typename MemberOp, int Direction>
00033 class PartialReduxExpr;
00034 
00035 namespace internal {
00036 template<typename MatrixType, typename MemberOp, int Direction>
00037 struct traits<PartialReduxExpr<MatrixType, MemberOp, Direction> >
00038  : traits<MatrixType>
00039 {
00040   typedef typename MemberOp::result_type Scalar;
00041   typedef typename traits<MatrixType>::StorageKind StorageKind;
00042   typedef typename traits<MatrixType>::XprKind XprKind;
00043   typedef typename MatrixType::Scalar InputScalar;
00044   enum {
00045     RowsAtCompileTime = Direction==Vertical   ? 1 : MatrixType::RowsAtCompileTime,
00046     ColsAtCompileTime = Direction==Horizontal ? 1 : MatrixType::ColsAtCompileTime,
00047     MaxRowsAtCompileTime = Direction==Vertical   ? 1 : MatrixType::MaxRowsAtCompileTime,
00048     MaxColsAtCompileTime = Direction==Horizontal ? 1 : MatrixType::MaxColsAtCompileTime,
00049     Flags = RowsAtCompileTime == 1 ? RowMajorBit : 0,
00050     TraversalSize = Direction==Vertical ? MatrixType::RowsAtCompileTime :  MatrixType::ColsAtCompileTime
00051   };
00052 };
00053 }
00054 
00055 template< typename MatrixType, typename MemberOp, int Direction>
00056 class PartialReduxExpr : public internal::dense_xpr_base< PartialReduxExpr<MatrixType, MemberOp, Direction> >::type,
00057                          internal::no_assignment_operator
00058 {
00059   public:
00060 
00061     typedef typename internal::dense_xpr_base<PartialReduxExpr>::type Base;
00062     EIGEN_DENSE_PUBLIC_INTERFACE(PartialReduxExpr)
00063 
00064     EIGEN_DEVICE_FUNC
00065     explicit PartialReduxExpr(const MatrixType& mat, const MemberOp& func = MemberOp())
00066       : m_matrix(mat), m_functor(func) {}
00067 
00068     EIGEN_DEVICE_FUNC
00069     Index rows() const { return (Direction==Vertical   ? 1 : m_matrix.rows()); }
00070     EIGEN_DEVICE_FUNC
00071     Index cols() const { return (Direction==Horizontal ? 1 : m_matrix.cols()); }
00072 
00073     EIGEN_DEVICE_FUNC
00074     typename MatrixType::Nested nestedExpression() const { return m_matrix; }
00075 
00076     EIGEN_DEVICE_FUNC
00077     const MemberOp& functor() const { return m_functor; }
00078 
00079   protected:
00080     typename MatrixType::Nested m_matrix;
00081     const MemberOp m_functor;
00082 };
00083 
00084 #define EIGEN_MEMBER_FUNCTOR(MEMBER,COST)                               \
00085   template <typename ResultType>                                        \
00086   struct member_##MEMBER {                                              \
00087     EIGEN_EMPTY_STRUCT_CTOR(member_##MEMBER)                            \
00088     typedef ResultType result_type;                                     \
00089     template<typename Scalar, int Size> struct Cost                     \
00090     { enum { value = COST }; };                                         \
00091     template<typename XprType>                                          \
00092     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE                               \
00093     ResultType operator()(const XprType& mat) const                     \
00094     { return mat.MEMBER(); } \
00095   }
00096 
00097 namespace internal {
00098 
00099 EIGEN_MEMBER_FUNCTOR(squaredNorm, Size * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost);
00100 EIGEN_MEMBER_FUNCTOR(norm, (Size+5) * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost);
00101 EIGEN_MEMBER_FUNCTOR(stableNorm, (Size+5) * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost);
00102 EIGEN_MEMBER_FUNCTOR(blueNorm, (Size+5) * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost);
00103 EIGEN_MEMBER_FUNCTOR(hypotNorm, (Size-1) * functor_traits<scalar_hypot_op<Scalar> >::Cost );
00104 EIGEN_MEMBER_FUNCTOR(sum, (Size-1)*NumTraits<Scalar>::AddCost);
00105 EIGEN_MEMBER_FUNCTOR(mean, (Size-1)*NumTraits<Scalar>::AddCost + NumTraits<Scalar>::MulCost);
00106 EIGEN_MEMBER_FUNCTOR(minCoeff, (Size-1)*NumTraits<Scalar>::AddCost);
00107 EIGEN_MEMBER_FUNCTOR(maxCoeff, (Size-1)*NumTraits<Scalar>::AddCost);
00108 EIGEN_MEMBER_FUNCTOR(all, (Size-1)*NumTraits<Scalar>::AddCost);
00109 EIGEN_MEMBER_FUNCTOR(any, (Size-1)*NumTraits<Scalar>::AddCost);
00110 EIGEN_MEMBER_FUNCTOR(count, (Size-1)*NumTraits<Scalar>::AddCost);
00111 EIGEN_MEMBER_FUNCTOR(prod, (Size-1)*NumTraits<Scalar>::MulCost);
00112 
00113 template <int p, typename ResultType>
00114 struct member_lpnorm {
00115   typedef ResultType result_type;
00116   template<typename Scalar, int Size> struct Cost
00117   { enum { value = (Size+5) * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost }; };
00118   EIGEN_DEVICE_FUNC member_lpnorm() {}
00119   template<typename XprType>
00120   EIGEN_DEVICE_FUNC inline ResultType operator()(const XprType& mat) const
00121   { return mat.template lpNorm<p>(); }
00122 };
00123 
00124 template <typename BinaryOp, typename Scalar>
00125 struct member_redux {
00126   typedef typename result_of<
00127                      BinaryOp(const Scalar&,const Scalar&)
00128                    >::type  result_type;
00129   template<typename _Scalar, int Size> struct Cost
00130   { enum { value = (Size-1) * functor_traits<BinaryOp>::Cost }; };
00131   EIGEN_DEVICE_FUNC explicit member_redux(const BinaryOp func) : m_functor(func) {}
00132   template<typename Derived>
00133   EIGEN_DEVICE_FUNC inline result_type operator()(const DenseBase<Derived>& mat) const
00134   { return mat.redux(m_functor); }
00135   const BinaryOp m_functor;
00136 };
00137 }
00138 
00156 template<typename ExpressionType, int Direction> class VectorwiseOp
00157 {
00158   public:
00159 
00160     typedef typename ExpressionType::Scalar Scalar;
00161     typedef typename ExpressionType::RealScalar RealScalar;
00162     typedef Eigen::Index Index; 
00163     typedef typename internal::ref_selector<ExpressionType>::non_const_type ExpressionTypeNested;
00164     typedef typename internal::remove_all<ExpressionTypeNested>::type ExpressionTypeNestedCleaned;
00165 
00166     template<template<typename _Scalar> class Functor,
00167                       typename Scalar_=Scalar> struct ReturnType
00168     {
00169       typedef PartialReduxExpr<ExpressionType,
00170                                Functor<Scalar_>,
00171                                Direction
00172                               > Type;
00173     };
00174 
00175     template<typename BinaryOp> struct ReduxReturnType
00176     {
00177       typedef PartialReduxExpr<ExpressionType,
00178                                internal::member_redux<BinaryOp,Scalar>,
00179                                Direction
00180                               > Type;
00181     };
00182 
00183     enum {
00184       isVertical   = (Direction==Vertical) ? 1 : 0,
00185       isHorizontal = (Direction==Horizontal) ? 1 : 0
00186     };
00187 
00188   protected:
00189 
00190     typedef typename internal::conditional<isVertical,
00191                                typename ExpressionType::ColXpr,
00192                                typename ExpressionType::RowXpr>::type SubVector;
00195     EIGEN_DEVICE_FUNC
00196     SubVector subVector(Index i)
00197     {
00198       return SubVector(m_matrix.derived(),i);
00199     }
00200 
00203     EIGEN_DEVICE_FUNC
00204     Index subVectors() const
00205     { return isVertical?m_matrix.cols():m_matrix.rows(); }
00206 
00207     template<typename OtherDerived> struct ExtendedType {
00208       typedef Replicate<OtherDerived,
00209                         isVertical   ? 1 : ExpressionType::RowsAtCompileTime,
00210                         isHorizontal ? 1 : ExpressionType::ColsAtCompileTime> Type;
00211     };
00212 
00215     template<typename OtherDerived>
00216     EIGEN_DEVICE_FUNC
00217     typename ExtendedType<OtherDerived>::Type
00218     extendedTo(const DenseBase<OtherDerived>& other) const
00219     {
00220       EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(isVertical, OtherDerived::MaxColsAtCompileTime==1),
00221                           YOU_PASSED_A_ROW_VECTOR_BUT_A_COLUMN_VECTOR_WAS_EXPECTED)
00222       EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(isHorizontal, OtherDerived::MaxRowsAtCompileTime==1),
00223                           YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED)
00224       return typename ExtendedType<OtherDerived>::Type
00225                       (other.derived(),
00226                        isVertical   ? 1 : m_matrix.rows(),
00227                        isHorizontal ? 1 : m_matrix.cols());
00228     }
00229 
00230     template<typename OtherDerived> struct OppositeExtendedType {
00231       typedef Replicate<OtherDerived,
00232                         isHorizontal ? 1 : ExpressionType::RowsAtCompileTime,
00233                         isVertical   ? 1 : ExpressionType::ColsAtCompileTime> Type;
00234     };
00235 
00238     template<typename OtherDerived>
00239     EIGEN_DEVICE_FUNC
00240     typename OppositeExtendedType<OtherDerived>::Type
00241     extendedToOpposite(const DenseBase<OtherDerived>& other) const
00242     {
00243       EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(isHorizontal, OtherDerived::MaxColsAtCompileTime==1),
00244                           YOU_PASSED_A_ROW_VECTOR_BUT_A_COLUMN_VECTOR_WAS_EXPECTED)
00245       EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(isVertical, OtherDerived::MaxRowsAtCompileTime==1),
00246                           YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED)
00247       return typename OppositeExtendedType<OtherDerived>::Type
00248                       (other.derived(),
00249                        isHorizontal  ? 1 : m_matrix.rows(),
00250                        isVertical    ? 1 : m_matrix.cols());
00251     }
00252 
00253   public:
00254     EIGEN_DEVICE_FUNC
00255     explicit inline VectorwiseOp(ExpressionType& matrix) : m_matrix(matrix) {}
00256 
00258     EIGEN_DEVICE_FUNC
00259     inline const ExpressionType& _expression() const { return m_matrix; }
00260 
00268     template<typename BinaryOp>
00269     EIGEN_DEVICE_FUNC
00270     const typename ReduxReturnType<BinaryOp>::Type
00271     redux(const BinaryOp& func = BinaryOp()) const
00272     { return typename ReduxReturnType<BinaryOp>::Type(_expression(), internal::member_redux<BinaryOp,Scalar>(func)); }
00273 
00274     typedef typename ReturnType<internal::member_minCoeff>::Type MinCoeffReturnType;
00275     typedef typename ReturnType<internal::member_maxCoeff>::Type MaxCoeffReturnType;
00276     typedef typename ReturnType<internal::member_squaredNorm,RealScalar>::Type SquaredNormReturnType;
00277     typedef typename ReturnType<internal::member_norm,RealScalar>::Type NormReturnType;
00278     typedef typename ReturnType<internal::member_blueNorm,RealScalar>::Type BlueNormReturnType;
00279     typedef typename ReturnType<internal::member_stableNorm,RealScalar>::Type StableNormReturnType;
00280     typedef typename ReturnType<internal::member_hypotNorm,RealScalar>::Type HypotNormReturnType;
00281     typedef typename ReturnType<internal::member_sum>::Type SumReturnType;
00282     typedef typename ReturnType<internal::member_mean>::Type MeanReturnType;
00283     typedef typename ReturnType<internal::member_all>::Type AllReturnType;
00284     typedef typename ReturnType<internal::member_any>::Type AnyReturnType;
00285     typedef PartialReduxExpr<ExpressionType, internal::member_count<Index>, Direction> CountReturnType;
00286     typedef typename ReturnType<internal::member_prod>::Type ProdReturnType;
00287     typedef Reverse<const ExpressionType, Direction> ConstReverseReturnType;
00288     typedef Reverse<ExpressionType, Direction> ReverseReturnType;
00289 
00290     template<int p> struct LpNormReturnType {
00291       typedef PartialReduxExpr<ExpressionType, internal::member_lpnorm<p,RealScalar>,Direction> Type;
00292     };
00293 
00303     EIGEN_DEVICE_FUNC
00304     const MinCoeffReturnType minCoeff() const
00305     { return MinCoeffReturnType(_expression()); }
00306 
00316     EIGEN_DEVICE_FUNC
00317     const MaxCoeffReturnType maxCoeff() const
00318     { return MaxCoeffReturnType(_expression()); }
00319 
00328     EIGEN_DEVICE_FUNC
00329     const SquaredNormReturnType squaredNorm() const
00330     { return SquaredNormReturnType(_expression()); }
00331 
00340     EIGEN_DEVICE_FUNC
00341     const NormReturnType norm() const
00342     { return NormReturnType(_expression()); }
00343 
00352     template<int p>
00353     EIGEN_DEVICE_FUNC
00354     const typename LpNormReturnType<p>::Type lpNorm() const
00355     { return typename LpNormReturnType<p>::Type(_expression()); }
00356 
00357 
00364     EIGEN_DEVICE_FUNC
00365     const BlueNormReturnType blueNorm() const
00366     { return BlueNormReturnType(_expression()); }
00367 
00368 
00375     EIGEN_DEVICE_FUNC
00376     const StableNormReturnType stableNorm() const
00377     { return StableNormReturnType(_expression()); }
00378 
00379 
00386     EIGEN_DEVICE_FUNC
00387     const HypotNormReturnType hypotNorm() const
00388     { return HypotNormReturnType(_expression()); }
00389 
00397     EIGEN_DEVICE_FUNC
00398     const SumReturnType sum() const
00399     { return SumReturnType(_expression()); }
00400 
00405     EIGEN_DEVICE_FUNC
00406     const MeanReturnType mean() const
00407     { return MeanReturnType(_expression()); }
00408 
00414     EIGEN_DEVICE_FUNC
00415     const AllReturnType all() const
00416     { return AllReturnType(_expression()); }
00417 
00423     EIGEN_DEVICE_FUNC
00424     const AnyReturnType any() const
00425     { return AnyReturnType(_expression()); }
00426 
00436     EIGEN_DEVICE_FUNC
00437     const CountReturnType count() const
00438     { return CountReturnType(_expression()); }
00439 
00447     EIGEN_DEVICE_FUNC
00448     const ProdReturnType prod() const
00449     { return ProdReturnType(_expression()); }
00450 
00451 
00459     EIGEN_DEVICE_FUNC
00460     const ConstReverseReturnType reverse() const
00461     { return ConstReverseReturnType( _expression() ); }
00462 
00467     EIGEN_DEVICE_FUNC
00468     ReverseReturnType reverse()
00469     { return ReverseReturnType( _expression() ); }
00470 
00471     typedef Replicate<ExpressionType,(isVertical?Dynamic:1),(isHorizontal?Dynamic:1)> ReplicateReturnType;
00472     EIGEN_DEVICE_FUNC
00473     const ReplicateReturnType replicate(Index factor) const;
00474 
00483     // NOTE implemented here because of sunstudio's compilation errors
00484     // isVertical*Factor+isHorizontal instead of (isVertical?Factor:1) to handle CUDA bug with ternary operator
00485     template<int Factor> const Replicate<ExpressionType,isVertical*Factor+isHorizontal,isHorizontal*Factor+isVertical>
00486     EIGEN_DEVICE_FUNC
00487     replicate(Index factor = Factor) const
00488     {
00489       return Replicate<ExpressionType,(isVertical?Factor:1),(isHorizontal?Factor:1)>
00490           (_expression(),isVertical?factor:1,isHorizontal?factor:1);
00491     }
00492 
00494 
00496     template<typename OtherDerived>
00497     EIGEN_DEVICE_FUNC
00498     ExpressionType& operator=(const DenseBase<OtherDerived>& other)
00499     {
00500       EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
00501       EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
00502       //eigen_assert((m_matrix.isNull()) == (other.isNull())); FIXME
00503       return const_cast<ExpressionType&>(m_matrix = extendedTo(other.derived()));
00504     }
00505 
00507     template<typename OtherDerived>
00508     EIGEN_DEVICE_FUNC
00509     ExpressionType& operator+=(const DenseBase<OtherDerived>& other)
00510     {
00511       EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
00512       EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
00513       return const_cast<ExpressionType&>(m_matrix += extendedTo(other.derived()));
00514     }
00515 
00517     template<typename OtherDerived>
00518     EIGEN_DEVICE_FUNC
00519     ExpressionType& operator-=(const DenseBase<OtherDerived>& other)
00520     {
00521       EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
00522       EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
00523       return const_cast<ExpressionType&>(m_matrix -= extendedTo(other.derived()));
00524     }
00525 
00527     template<typename OtherDerived>
00528     EIGEN_DEVICE_FUNC
00529     ExpressionType& operator*=(const DenseBase<OtherDerived>& other)
00530     {
00531       EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
00532       EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
00533       EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
00534       m_matrix *= extendedTo(other.derived());
00535       return const_cast<ExpressionType&>(m_matrix);
00536     }
00537 
00539     template<typename OtherDerived>
00540     EIGEN_DEVICE_FUNC
00541     ExpressionType& operator/=(const DenseBase<OtherDerived>& other)
00542     {
00543       EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
00544       EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
00545       EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
00546       m_matrix /= extendedTo(other.derived());
00547       return const_cast<ExpressionType&>(m_matrix);
00548     }
00549 
00551     template<typename OtherDerived> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
00552     CwiseBinaryOp<internal::scalar_sum_op<Scalar,typename OtherDerived::Scalar>,
00553                   const ExpressionTypeNestedCleaned,
00554                   const typename ExtendedType<OtherDerived>::Type>
00555     operator+(const DenseBase<OtherDerived>& other) const
00556     {
00557       EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
00558       EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
00559       return m_matrix + extendedTo(other.derived());
00560     }
00561 
00563     template<typename OtherDerived>
00564     EIGEN_DEVICE_FUNC
00565     CwiseBinaryOp<internal::scalar_difference_op<Scalar,typename OtherDerived::Scalar>,
00566                   const ExpressionTypeNestedCleaned,
00567                   const typename ExtendedType<OtherDerived>::Type>
00568     operator-(const DenseBase<OtherDerived>& other) const
00569     {
00570       EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
00571       EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
00572       return m_matrix - extendedTo(other.derived());
00573     }
00574 
00577     template<typename OtherDerived> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
00578     CwiseBinaryOp<internal::scalar_product_op<Scalar>,
00579                   const ExpressionTypeNestedCleaned,
00580                   const typename ExtendedType<OtherDerived>::Type>
00581     EIGEN_DEVICE_FUNC
00582     operator*(const DenseBase<OtherDerived>& other) const
00583     {
00584       EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
00585       EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
00586       EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
00587       return m_matrix * extendedTo(other.derived());
00588     }
00589 
00592     template<typename OtherDerived>
00593     EIGEN_DEVICE_FUNC
00594     CwiseBinaryOp<internal::scalar_quotient_op<Scalar>,
00595                   const ExpressionTypeNestedCleaned,
00596                   const typename ExtendedType<OtherDerived>::Type>
00597     operator/(const DenseBase<OtherDerived>& other) const
00598     {
00599       EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
00600       EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
00601       EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
00602       return m_matrix / extendedTo(other.derived());
00603     }
00604 
00609     EIGEN_DEVICE_FUNC
00610     CwiseBinaryOp<internal::scalar_quotient_op<Scalar>,
00611                   const ExpressionTypeNestedCleaned,
00612                   const typename OppositeExtendedType<typename ReturnType<internal::member_norm,RealScalar>::Type>::Type>
00613     normalized() const { return m_matrix.cwiseQuotient(extendedToOpposite(this->norm())); }
00614 
00615 
00619     EIGEN_DEVICE_FUNC void normalize() {
00620       m_matrix = this->normalized();
00621     }
00622 
00623     EIGEN_DEVICE_FUNC inline void reverseInPlace();
00624 
00626 
00627     typedef Homogeneous<ExpressionType,Direction> HomogeneousReturnType;
00628     EIGEN_DEVICE_FUNC
00629     HomogeneousReturnType homogeneous() const;
00630 
00631     typedef typename ExpressionType::PlainObject CrossReturnType;
00632     template<typename OtherDerived>
00633     EIGEN_DEVICE_FUNC
00634     const CrossReturnType cross(const MatrixBase<OtherDerived>& other) const;
00635 
00636     enum {
00637       HNormalized_Size = Direction==Vertical ? internal::traits<ExpressionType>::RowsAtCompileTime
00638                                              : internal::traits<ExpressionType>::ColsAtCompileTime,
00639       HNormalized_SizeMinusOne = HNormalized_Size==Dynamic ? Dynamic : HNormalized_Size-1
00640     };
00641     typedef Block<const ExpressionType,
00642                   Direction==Vertical   ? int(HNormalized_SizeMinusOne)
00643                                         : int(internal::traits<ExpressionType>::RowsAtCompileTime),
00644                   Direction==Horizontal ? int(HNormalized_SizeMinusOne)
00645                                         : int(internal::traits<ExpressionType>::ColsAtCompileTime)>
00646             HNormalized_Block;
00647     typedef Block<const ExpressionType,
00648                   Direction==Vertical   ? 1 : int(internal::traits<ExpressionType>::RowsAtCompileTime),
00649                   Direction==Horizontal ? 1 : int(internal::traits<ExpressionType>::ColsAtCompileTime)>
00650             HNormalized_Factors;
00651     typedef CwiseBinaryOp<internal::scalar_quotient_op<typename internal::traits<ExpressionType>::Scalar>,
00652                 const HNormalized_Block,
00653                 const Replicate<HNormalized_Factors,
00654                   Direction==Vertical   ? HNormalized_SizeMinusOne : 1,
00655                   Direction==Horizontal ? HNormalized_SizeMinusOne : 1> >
00656             HNormalizedReturnType;
00657 
00658     EIGEN_DEVICE_FUNC
00659     const HNormalizedReturnType hnormalized() const;
00660 
00661   protected:
00662     ExpressionTypeNested m_matrix;
00663 };
00664 
00665 //const colwise moved to DenseBase.h due to CUDA compiler bug
00666 
00667 
00672 template<typename Derived>
00673 inline typename DenseBase<Derived>::ColwiseReturnType
00674 DenseBase<Derived>::colwise()
00675 {
00676   return ColwiseReturnType(derived());
00677 }
00678 
00679 //const rowwise moved to DenseBase.h due to CUDA compiler bug
00680 
00681 
00686 template<typename Derived>
00687 inline typename DenseBase<Derived>::RowwiseReturnType
00688 DenseBase<Derived>::rowwise()
00689 {
00690   return RowwiseReturnType(derived());
00691 }
00692 
00693 } // end namespace Eigen
00694 
00695 #endif // EIGEN_PARTIAL_REDUX_H
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends