Eigen  3.3.3
GeneralProduct.h
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
00005 // Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud@inria.fr>
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_GENERAL_PRODUCT_H
00012 #define EIGEN_GENERAL_PRODUCT_H
00013 
00014 namespace Eigen {
00015 
00016 enum {
00017   Large = 2,
00018   Small = 3
00019 };
00020 
00021 namespace internal {
00022 
00023 template<int Rows, int Cols, int Depth> struct product_type_selector;
00024 
00025 template<int Size, int MaxSize> struct product_size_category
00026 {
00027   enum { is_large = MaxSize == Dynamic ||
00028                     Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD ||
00029                     (Size==Dynamic && MaxSize>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD),
00030          value = is_large  ? Large
00031                : Size == 1 ? 1
00032                            : Small
00033   };
00034 };
00035 
00036 template<typename Lhs, typename Rhs> struct product_type
00037 {
00038   typedef typename remove_all<Lhs>::type _Lhs;
00039   typedef typename remove_all<Rhs>::type _Rhs;
00040   enum {
00041     MaxRows = traits<_Lhs>::MaxRowsAtCompileTime,
00042     Rows    = traits<_Lhs>::RowsAtCompileTime,
00043     MaxCols = traits<_Rhs>::MaxColsAtCompileTime,
00044     Cols    = traits<_Rhs>::ColsAtCompileTime,
00045     MaxDepth = EIGEN_SIZE_MIN_PREFER_FIXED(traits<_Lhs>::MaxColsAtCompileTime,
00046                                            traits<_Rhs>::MaxRowsAtCompileTime),
00047     Depth = EIGEN_SIZE_MIN_PREFER_FIXED(traits<_Lhs>::ColsAtCompileTime,
00048                                         traits<_Rhs>::RowsAtCompileTime)
00049   };
00050 
00051   // the splitting into different lines of code here, introducing the _select enums and the typedef below,
00052   // is to work around an internal compiler error with gcc 4.1 and 4.2.
00053 private:
00054   enum {
00055     rows_select = product_size_category<Rows,MaxRows>::value,
00056     cols_select = product_size_category<Cols,MaxCols>::value,
00057     depth_select = product_size_category<Depth,MaxDepth>::value
00058   };
00059   typedef product_type_selector<rows_select, cols_select, depth_select> selector;
00060 
00061 public:
00062   enum {
00063     value = selector::ret,
00064     ret = selector::ret
00065   };
00066 #ifdef EIGEN_DEBUG_PRODUCT
00067   static void debug()
00068   {
00069       EIGEN_DEBUG_VAR(Rows);
00070       EIGEN_DEBUG_VAR(Cols);
00071       EIGEN_DEBUG_VAR(Depth);
00072       EIGEN_DEBUG_VAR(rows_select);
00073       EIGEN_DEBUG_VAR(cols_select);
00074       EIGEN_DEBUG_VAR(depth_select);
00075       EIGEN_DEBUG_VAR(value);
00076   }
00077 #endif
00078 };
00079 
00080 /* The following allows to select the kind of product at compile time
00081  * based on the three dimensions of the product.
00082  * This is a compile time mapping from {1,Small,Large}^3 -> {product types} */
00083 // FIXME I'm not sure the current mapping is the ideal one.
00084 template<int M, int N>  struct product_type_selector<M,N,1>              { enum { ret = OuterProduct }; };
00085 template<int M>         struct product_type_selector<M, 1, 1>            { enum { ret = LazyCoeffBasedProductMode }; };
00086 template<int N>         struct product_type_selector<1, N, 1>            { enum { ret = LazyCoeffBasedProductMode }; };
00087 template<int Depth>     struct product_type_selector<1,    1,    Depth>  { enum { ret = InnerProduct }; };
00088 template<>              struct product_type_selector<1,    1,    1>      { enum { ret = InnerProduct }; };
00089 template<>              struct product_type_selector<Small,1,    Small>  { enum { ret = CoeffBasedProductMode }; };
00090 template<>              struct product_type_selector<1,    Small,Small>  { enum { ret = CoeffBasedProductMode }; };
00091 template<>              struct product_type_selector<Small,Small,Small>  { enum { ret = CoeffBasedProductMode }; };
00092 template<>              struct product_type_selector<Small, Small, 1>    { enum { ret = LazyCoeffBasedProductMode }; };
00093 template<>              struct product_type_selector<Small, Large, 1>    { enum { ret = LazyCoeffBasedProductMode }; };
00094 template<>              struct product_type_selector<Large, Small, 1>    { enum { ret = LazyCoeffBasedProductMode }; };
00095 template<>              struct product_type_selector<1,    Large,Small>  { enum { ret = CoeffBasedProductMode }; };
00096 template<>              struct product_type_selector<1,    Large,Large>  { enum { ret = GemvProduct }; };
00097 template<>              struct product_type_selector<1,    Small,Large>  { enum { ret = CoeffBasedProductMode }; };
00098 template<>              struct product_type_selector<Large,1,    Small>  { enum { ret = CoeffBasedProductMode }; };
00099 template<>              struct product_type_selector<Large,1,    Large>  { enum { ret = GemvProduct }; };
00100 template<>              struct product_type_selector<Small,1,    Large>  { enum { ret = CoeffBasedProductMode }; };
00101 template<>              struct product_type_selector<Small,Small,Large>  { enum { ret = GemmProduct }; };
00102 template<>              struct product_type_selector<Large,Small,Large>  { enum { ret = GemmProduct }; };
00103 template<>              struct product_type_selector<Small,Large,Large>  { enum { ret = GemmProduct }; };
00104 template<>              struct product_type_selector<Large,Large,Large>  { enum { ret = GemmProduct }; };
00105 template<>              struct product_type_selector<Large,Small,Small>  { enum { ret = CoeffBasedProductMode }; };
00106 template<>              struct product_type_selector<Small,Large,Small>  { enum { ret = CoeffBasedProductMode }; };
00107 template<>              struct product_type_selector<Large,Large,Small>  { enum { ret = GemmProduct }; };
00108 
00109 } // end namespace internal
00110 
00111 /***********************************************************************
00112 *  Implementation of Inner Vector Vector Product
00113 ***********************************************************************/
00114 
00115 // FIXME : maybe the "inner product" could return a Scalar
00116 // instead of a 1x1 matrix ??
00117 // Pro: more natural for the user
00118 // Cons: this could be a problem if in a meta unrolled algorithm a matrix-matrix
00119 // product ends up to a row-vector times col-vector product... To tackle this use
00120 // case, we could have a specialization for Block<MatrixType,1,1> with: operator=(Scalar x);
00121 
00122 /***********************************************************************
00123 *  Implementation of Outer Vector Vector Product
00124 ***********************************************************************/
00125 
00126 /***********************************************************************
00127 *  Implementation of General Matrix Vector Product
00128 ***********************************************************************/
00129 
00130 /*  According to the shape/flags of the matrix we have to distinghish 3 different cases:
00131  *   1 - the matrix is col-major, BLAS compatible and M is large => call fast BLAS-like colmajor routine
00132  *   2 - the matrix is row-major, BLAS compatible and N is large => call fast BLAS-like rowmajor routine
00133  *   3 - all other cases are handled using a simple loop along the outer-storage direction.
00134  *  Therefore we need a lower level meta selector.
00135  *  Furthermore, if the matrix is the rhs, then the product has to be transposed.
00136  */
00137 namespace internal {
00138 
00139 template<int Side, int StorageOrder, bool BlasCompatible>
00140 struct gemv_dense_selector;
00141 
00142 } // end namespace internal
00143 
00144 namespace internal {
00145 
00146 template<typename Scalar,int Size,int MaxSize,bool Cond> struct gemv_static_vector_if;
00147 
00148 template<typename Scalar,int Size,int MaxSize>
00149 struct gemv_static_vector_if<Scalar,Size,MaxSize,false>
00150 {
00151   EIGEN_STRONG_INLINE  Scalar* data() { eigen_internal_assert(false && "should never be called"); return 0; }
00152 };
00153 
00154 template<typename Scalar,int Size>
00155 struct gemv_static_vector_if<Scalar,Size,Dynamic,true>
00156 {
00157   EIGEN_STRONG_INLINE Scalar* data() { return 0; }
00158 };
00159 
00160 template<typename Scalar,int Size,int MaxSize>
00161 struct gemv_static_vector_if<Scalar,Size,MaxSize,true>
00162 {
00163   enum {
00164     ForceAlignment  = internal::packet_traits<Scalar>::Vectorizable,
00165     PacketSize      = internal::packet_traits<Scalar>::size
00166   };
00167   #if EIGEN_MAX_STATIC_ALIGN_BYTES!=0
00168   internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize),0,EIGEN_PLAIN_ENUM_MIN(AlignedMax,PacketSize)> m_data;
00169   EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; }
00170   #else
00171   // Some architectures cannot align on the stack,
00172   // => let's manually enforce alignment by allocating more data and return the address of the first aligned element.
00173   internal::plain_array<Scalar,EIGEN_SIZE_MIN_PREFER_FIXED(Size,MaxSize)+(ForceAlignment?EIGEN_MAX_ALIGN_BYTES:0),0> m_data;
00174   EIGEN_STRONG_INLINE Scalar* data() {
00175     return ForceAlignment
00176             ? reinterpret_cast<Scalar*>((internal::UIntPtr(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES-1))) + EIGEN_MAX_ALIGN_BYTES)
00177             : m_data.array;
00178   }
00179   #endif
00180 };
00181 
00182 // The vector is on the left => transposition
00183 template<int StorageOrder, bool BlasCompatible>
00184 struct gemv_dense_selector<OnTheLeft,StorageOrder,BlasCompatible>
00185 {
00186   template<typename Lhs, typename Rhs, typename Dest>
00187   static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha)
00188   {
00189     Transpose<Dest> destT(dest);
00190     enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor };
00191     gemv_dense_selector<OnTheRight,OtherStorageOrder,BlasCompatible>
00192       ::run(rhs.transpose(), lhs.transpose(), destT, alpha);
00193   }
00194 };
00195 
00196 template<> struct gemv_dense_selector<OnTheRight,ColMajor,true>
00197 {
00198   template<typename Lhs, typename Rhs, typename Dest>
00199   static inline void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha)
00200   {
00201     typedef typename Lhs::Scalar   LhsScalar;
00202     typedef typename Rhs::Scalar   RhsScalar;
00203     typedef typename Dest::Scalar  ResScalar;
00204     typedef typename Dest::RealScalar  RealScalar;
00205     
00206     typedef internal::blas_traits<Lhs> LhsBlasTraits;
00207     typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
00208     typedef internal::blas_traits<Rhs> RhsBlasTraits;
00209     typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
00210   
00211     typedef Map<Matrix<ResScalar,Dynamic,1>, EIGEN_PLAIN_ENUM_MIN(AlignedMax,internal::packet_traits<ResScalar>::size)> MappedDest;
00212 
00213     ActualLhsType actualLhs = LhsBlasTraits::extract(lhs);
00214     ActualRhsType actualRhs = RhsBlasTraits::extract(rhs);
00215 
00216     ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(lhs)
00217                                   * RhsBlasTraits::extractScalarFactor(rhs);
00218 
00219     // make sure Dest is a compile-time vector type (bug 1166)
00220     typedef typename conditional<Dest::IsVectorAtCompileTime, Dest, typename Dest::ColXpr>::type ActualDest;
00221 
00222     enum {
00223       // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1
00224       // on, the other hand it is good for the cache to pack the vector anyways...
00225       EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime==1),
00226       ComplexByReal = (NumTraits<LhsScalar>::IsComplex) && (!NumTraits<RhsScalar>::IsComplex),
00227       MightCannotUseDest = (!EvalToDestAtCompileTime) || ComplexByReal
00228     };
00229 
00230     typedef const_blas_data_mapper<LhsScalar,Index,ColMajor> LhsMapper;
00231     typedef const_blas_data_mapper<RhsScalar,Index,RowMajor> RhsMapper;
00232     RhsScalar compatibleAlpha = get_factor<ResScalar,RhsScalar>::run(actualAlpha);
00233 
00234     if(!MightCannotUseDest)
00235     {
00236       // shortcut if we are sure to be able to use dest directly,
00237       // this ease the compiler to generate cleaner and more optimzized code for most common cases
00238       general_matrix_vector_product
00239           <Index,LhsScalar,LhsMapper,ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsMapper,RhsBlasTraits::NeedToConjugate>::run(
00240           actualLhs.rows(), actualLhs.cols(),
00241           LhsMapper(actualLhs.data(), actualLhs.outerStride()),
00242           RhsMapper(actualRhs.data(), actualRhs.innerStride()),
00243           dest.data(), 1,
00244           compatibleAlpha);
00245     }
00246     else
00247     {
00248       gemv_static_vector_if<ResScalar,ActualDest::SizeAtCompileTime,ActualDest::MaxSizeAtCompileTime,MightCannotUseDest> static_dest;
00249 
00250       const bool alphaIsCompatible = (!ComplexByReal) || (numext::imag(actualAlpha)==RealScalar(0));
00251       const bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible;
00252 
00253       ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(),
00254                                                     evalToDest ? dest.data() : static_dest.data());
00255 
00256       if(!evalToDest)
00257       {
00258         #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
00259         Index size = dest.size();
00260         EIGEN_DENSE_STORAGE_CTOR_PLUGIN
00261         #endif
00262         if(!alphaIsCompatible)
00263         {
00264           MappedDest(actualDestPtr, dest.size()).setZero();
00265           compatibleAlpha = RhsScalar(1);
00266         }
00267         else
00268           MappedDest(actualDestPtr, dest.size()) = dest;
00269       }
00270 
00271       general_matrix_vector_product
00272           <Index,LhsScalar,LhsMapper,ColMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsMapper,RhsBlasTraits::NeedToConjugate>::run(
00273           actualLhs.rows(), actualLhs.cols(),
00274           LhsMapper(actualLhs.data(), actualLhs.outerStride()),
00275           RhsMapper(actualRhs.data(), actualRhs.innerStride()),
00276           actualDestPtr, 1,
00277           compatibleAlpha);
00278 
00279       if (!evalToDest)
00280       {
00281         if(!alphaIsCompatible)
00282           dest.matrix() += actualAlpha * MappedDest(actualDestPtr, dest.size());
00283         else
00284           dest = MappedDest(actualDestPtr, dest.size());
00285       }
00286     }
00287   }
00288 };
00289 
00290 template<> struct gemv_dense_selector<OnTheRight,RowMajor,true>
00291 {
00292   template<typename Lhs, typename Rhs, typename Dest>
00293   static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha)
00294   {
00295     typedef typename Lhs::Scalar   LhsScalar;
00296     typedef typename Rhs::Scalar   RhsScalar;
00297     typedef typename Dest::Scalar  ResScalar;
00298     
00299     typedef internal::blas_traits<Lhs> LhsBlasTraits;
00300     typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType;
00301     typedef internal::blas_traits<Rhs> RhsBlasTraits;
00302     typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType;
00303     typedef typename internal::remove_all<ActualRhsType>::type ActualRhsTypeCleaned;
00304 
00305     typename add_const<ActualLhsType>::type actualLhs = LhsBlasTraits::extract(lhs);
00306     typename add_const<ActualRhsType>::type actualRhs = RhsBlasTraits::extract(rhs);
00307 
00308     ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(lhs)
00309                                   * RhsBlasTraits::extractScalarFactor(rhs);
00310 
00311     enum {
00312       // FIXME find a way to allow an inner stride on the result if packet_traits<Scalar>::size==1
00313       // on, the other hand it is good for the cache to pack the vector anyways...
00314       DirectlyUseRhs = ActualRhsTypeCleaned::InnerStrideAtCompileTime==1
00315     };
00316 
00317     gemv_static_vector_if<RhsScalar,ActualRhsTypeCleaned::SizeAtCompileTime,ActualRhsTypeCleaned::MaxSizeAtCompileTime,!DirectlyUseRhs> static_rhs;
00318 
00319     ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhsPtr,actualRhs.size(),
00320         DirectlyUseRhs ? const_cast<RhsScalar*>(actualRhs.data()) : static_rhs.data());
00321 
00322     if(!DirectlyUseRhs)
00323     {
00324       #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
00325       Index size = actualRhs.size();
00326       EIGEN_DENSE_STORAGE_CTOR_PLUGIN
00327       #endif
00328       Map<typename ActualRhsTypeCleaned::PlainObject>(actualRhsPtr, actualRhs.size()) = actualRhs;
00329     }
00330 
00331     typedef const_blas_data_mapper<LhsScalar,Index,RowMajor> LhsMapper;
00332     typedef const_blas_data_mapper<RhsScalar,Index,ColMajor> RhsMapper;
00333     general_matrix_vector_product
00334         <Index,LhsScalar,LhsMapper,RowMajor,LhsBlasTraits::NeedToConjugate,RhsScalar,RhsMapper,RhsBlasTraits::NeedToConjugate>::run(
00335         actualLhs.rows(), actualLhs.cols(),
00336         LhsMapper(actualLhs.data(), actualLhs.outerStride()),
00337         RhsMapper(actualRhsPtr, 1),
00338         dest.data(), dest.col(0).innerStride(), //NOTE  if dest is not a vector at compile-time, then dest.innerStride() might be wrong. (bug 1166)
00339         actualAlpha);
00340   }
00341 };
00342 
00343 template<> struct gemv_dense_selector<OnTheRight,ColMajor,false>
00344 {
00345   template<typename Lhs, typename Rhs, typename Dest>
00346   static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha)
00347   {
00348     EIGEN_STATIC_ASSERT((!nested_eval<Lhs,1>::Evaluate),EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE);
00349     // TODO if rhs is large enough it might be beneficial to make sure that dest is sequentially stored in memory, otherwise use a temp
00350     typename nested_eval<Rhs,1>::type actual_rhs(rhs);
00351     const Index size = rhs.rows();
00352     for(Index k=0; k<size; ++k)
00353       dest += (alpha*actual_rhs.coeff(k)) * lhs.col(k);
00354   }
00355 };
00356 
00357 template<> struct gemv_dense_selector<OnTheRight,RowMajor,false>
00358 {
00359   template<typename Lhs, typename Rhs, typename Dest>
00360   static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha)
00361   {
00362     EIGEN_STATIC_ASSERT((!nested_eval<Lhs,1>::Evaluate),EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE);
00363     typename nested_eval<Rhs,Lhs::RowsAtCompileTime>::type actual_rhs(rhs);
00364     const Index rows = dest.rows();
00365     for(Index i=0; i<rows; ++i)
00366       dest.coeffRef(i) += alpha * (lhs.row(i).cwiseProduct(actual_rhs.transpose())).sum();
00367   }
00368 };
00369 
00370 } // end namespace internal
00371 
00372 /***************************************************************************
00373 * Implementation of matrix base methods
00374 ***************************************************************************/
00375 
00382 #ifndef __CUDACC__
00383 
00384 template<typename Derived>
00385 template<typename OtherDerived>
00386 inline const Product<Derived, OtherDerived>
00387 MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
00388 {
00389   // A note regarding the function declaration: In MSVC, this function will sometimes
00390   // not be inlined since DenseStorage is an unwindable object for dynamic
00391   // matrices and product types are holding a member to store the result.
00392   // Thus it does not help tagging this function with EIGEN_STRONG_INLINE.
00393   enum {
00394     ProductIsValid =  Derived::ColsAtCompileTime==Dynamic
00395                    || OtherDerived::RowsAtCompileTime==Dynamic
00396                    || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime),
00397     AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime,
00398     SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived)
00399   };
00400   // note to the lost user:
00401   //    * for a dot product use: v1.dot(v2)
00402   //    * for a coeff-wise product use: v1.cwiseProduct(v2)
00403   EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes),
00404     INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
00405   EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors),
00406     INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
00407   EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT)
00408 #ifdef EIGEN_DEBUG_PRODUCT
00409   internal::product_type<Derived,OtherDerived>::debug();
00410 #endif
00411 
00412   return Product<Derived, OtherDerived>(derived(), other.derived());
00413 }
00414 
00415 #endif // __CUDACC__
00416 
00428 template<typename Derived>
00429 template<typename OtherDerived>
00430 const Product<Derived,OtherDerived,LazyProduct>
00431 MatrixBase<Derived>::lazyProduct(const MatrixBase<OtherDerived> &other) const
00432 {
00433   enum {
00434     ProductIsValid =  Derived::ColsAtCompileTime==Dynamic
00435                    || OtherDerived::RowsAtCompileTime==Dynamic
00436                    || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime),
00437     AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime,
00438     SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived)
00439   };
00440   // note to the lost user:
00441   //    * for a dot product use: v1.dot(v2)
00442   //    * for a coeff-wise product use: v1.cwiseProduct(v2)
00443   EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes),
00444     INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS)
00445   EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors),
00446     INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
00447   EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT)
00448 
00449   return Product<Derived,OtherDerived,LazyProduct>(derived(), other.derived());
00450 }
00451 
00452 } // end namespace Eigen
00453 
00454 #endif // EIGEN_PRODUCT_H
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends