1c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// This file is part of Eigen, a lightweight C++ template library
2c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// for linear algebra.
3c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath//
4c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// Copyright (C) 2007-2010 Benoit Jacob <jacob.benoit.1@gmail.com>
5c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
6c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath//
7c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// This Source Code Form is subject to the terms of the Mozilla
8c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// Public License v. 2.0. If a copy of the MPL was not distributed
9c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
11c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#ifndef EIGEN_DENSEBASE_H
12c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#define EIGEN_DENSEBASE_H
13c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
14c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathnamespace Eigen {
15c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
167faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandeznamespace internal {
177faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez
187faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// The index type defined by EIGEN_DEFAULT_DENSE_INDEX_TYPE must be a signed type.
197faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// This dummy function simply aims at checking that at compile time.
207faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandezstatic inline void check_DenseIndex_is_signed() {
217faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez  EIGEN_STATIC_ASSERT(NumTraits<DenseIndex>::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE);
227faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez}
237faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez
247faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez} // end namespace internal
257faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez
26c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath/** \class DenseBase
27c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * \ingroup Core_Module
28c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
29c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * \brief Base class for all dense matrices, vectors, and arrays
30c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
31c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * This class is the base that is inherited by all dense objects (matrix, vector, arrays,
32c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * and related expression types). The common Eigen API for dense objects is contained in this class.
33c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
34c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * \tparam Derived is the derived type, e.g., a matrix type or an expression.
35c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
36c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * This class can be extended with the help of the plugin mechanism described on the page
372b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang  * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_DENSEBASE_PLUGIN.
38c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
392b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang  * \sa \blank \ref TopicClassHierarchy
40c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  */
41c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtemplate<typename Derived> class DenseBase
42c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#ifndef EIGEN_PARSED_BY_DOXYGEN
43c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  : public DenseCoeffsBase<Derived>
442b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang#else
452b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang  : public DenseCoeffsBase<Derived,DirectWriteAccessors>
46c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#endif // not EIGEN_PARSED_BY_DOXYGEN
47c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath{
48c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  public:
49c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
502b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /** Inner iterator type to iterate over the coefficients of a row or column.
512b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * \sa class InnerIterator
522b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      */
532b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    typedef Eigen::InnerIterator<Derived> InnerIterator;
54c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
55c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef typename internal::traits<Derived>::StorageKind StorageKind;
56c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
572b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /**
582b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * \brief The type used to store indices
592b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * \details This typedef is relevant for types that store multiple indices such as
602b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      *          PermutationMatrix or Transpositions, otherwise it defaults to Eigen::Index
612b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * \sa \blank \ref TopicPreprocessorDirectives, Eigen::Index, SparseMatrixBase.
622b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang     */
632b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    typedef typename internal::traits<Derived>::StorageIndex StorageIndex;
64c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
652b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc. */
66c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef typename internal::traits<Derived>::Scalar Scalar;
672b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang
682b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc.
692b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      *
702b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * It is an alias for the Scalar type */
712b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    typedef Scalar value_type;
722b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang
73c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef typename NumTraits<Scalar>::Real RealScalar;
74c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef DenseCoeffsBase<Derived> Base;
752b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang
76c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::derived;
77c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::const_cast_derived;
78c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::rows;
79c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::cols;
80c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::size;
81c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::rowIndexByOuterInner;
82c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::colIndexByOuterInner;
83c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::coeff;
84c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::coeffByOuterInner;
85c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::operator();
86c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::operator[];
87c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::x;
88c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::y;
89c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::z;
90c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::w;
91c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::stride;
92c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::innerStride;
93c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::outerStride;
94c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::rowStride;
95c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    using Base::colStride;
96c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef typename Base::CoeffReturnType CoeffReturnType;
97c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
98c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    enum {
99c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
100c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
101c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath        /**< The number of rows at compile-time. This is just a copy of the value provided
102c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * by the \a Derived type. If a value is not known at compile-time,
103c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * it is set to the \a Dynamic constant.
104c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * \sa MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime */
105c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
106c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
107c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath        /**< The number of columns at compile-time. This is just a copy of the value provided
108c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * by the \a Derived type. If a value is not known at compile-time,
109c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * it is set to the \a Dynamic constant.
110c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */
111c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
112c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
113c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
114c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                                                   internal::traits<Derived>::ColsAtCompileTime>::ret),
115c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath        /**< This is equal to the number of coefficients, i.e. the number of
116c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * rows times the number of columns, or to \a Dynamic if this is not
117c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
118c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
119c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime,
120c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath        /**< This value is equal to the maximum possible number of rows that this expression
121c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * might have. If this expression might have an arbitrarily high number of rows,
122c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * this value is set to \a Dynamic.
123c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          *
124c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * This value is useful to know when evaluating an expression, in order to determine
125c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * whether it is possible to avoid doing a dynamic memory allocation.
126c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          *
127c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * \sa RowsAtCompileTime, MaxColsAtCompileTime, MaxSizeAtCompileTime
128c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          */
129c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
130c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime,
131c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath        /**< This value is equal to the maximum possible number of columns that this expression
132c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * might have. If this expression might have an arbitrarily high number of columns,
133c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * this value is set to \a Dynamic.
134c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          *
135c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * This value is useful to know when evaluating an expression, in order to determine
136c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * whether it is possible to avoid doing a dynamic memory allocation.
137c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          *
138c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * \sa ColsAtCompileTime, MaxRowsAtCompileTime, MaxSizeAtCompileTime
139c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          */
140c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
141c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      MaxSizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::MaxRowsAtCompileTime,
142c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                                                      internal::traits<Derived>::MaxColsAtCompileTime>::ret),
143c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath        /**< This value is equal to the maximum possible number of coefficients that this expression
144c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * might have. If this expression might have an arbitrarily high number of coefficients,
145c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * this value is set to \a Dynamic.
146c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          *
147c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * This value is useful to know when evaluating an expression, in order to determine
148c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * whether it is possible to avoid doing a dynamic memory allocation.
149c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          *
150c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * \sa SizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime
151c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          */
152c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
153c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      IsVectorAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime == 1
154c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                           || internal::traits<Derived>::MaxColsAtCompileTime == 1,
155c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath        /**< This is set to true if either the number of rows or the number of
156c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * columns is known at compile-time to be equal to 1. Indeed, in that case,
157c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * we are dealing with a column-vector (if there is only one column) or with
158c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * a row-vector (if there is only one row). */
159c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
160c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      Flags = internal::traits<Derived>::Flags,
161c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath        /**< This stores expression \ref flags flags which may or may not be inherited by new expressions
162c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          * constructed from this one. See the \ref flags "list of flags".
163c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath          */
164c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
165c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      IsRowMajor = int(Flags) & RowMajorBit, /**< True if this expression has row-major storage order. */
166c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
167c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? int(SizeAtCompileTime)
168c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                             : int(IsRowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime),
169c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
170c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      InnerStrideAtCompileTime = internal::inner_stride_at_compile_time<Derived>::ret,
171c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      OuterStrideAtCompileTime = internal::outer_stride_at_compile_time<Derived>::ret
172c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    };
1732b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang
1742b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    typedef typename internal::find_best_packet<Scalar,SizeAtCompileTime>::type PacketScalar;
175c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
1762b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    enum { IsPlainObjectBase = 0 };
1772b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang
1782b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /** The plain matrix type corresponding to this expression.
1792b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * \sa PlainObject */
1802b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    typedef Matrix<typename internal::traits<Derived>::Scalar,
1812b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang                internal::traits<Derived>::RowsAtCompileTime,
1822b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang                internal::traits<Derived>::ColsAtCompileTime,
1832b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang                AutoAlign | (internal::traits<Derived>::Flags&RowMajorBit ? RowMajor : ColMajor),
1842b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang                internal::traits<Derived>::MaxRowsAtCompileTime,
1852b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang                internal::traits<Derived>::MaxColsAtCompileTime
1862b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang          > PlainMatrix;
1872b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang
1882b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /** The plain array type corresponding to this expression.
1892b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * \sa PlainObject */
1902b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    typedef Array<typename internal::traits<Derived>::Scalar,
1912b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang                internal::traits<Derived>::RowsAtCompileTime,
1922b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang                internal::traits<Derived>::ColsAtCompileTime,
1932b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang                AutoAlign | (internal::traits<Derived>::Flags&RowMajorBit ? RowMajor : ColMajor),
1942b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang                internal::traits<Derived>::MaxRowsAtCompileTime,
1952b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang                internal::traits<Derived>::MaxColsAtCompileTime
1962b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang          > PlainArray;
1972b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang
1982b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /** \brief The plain matrix or array type corresponding to this expression.
1992b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      *
2002b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * This is not necessarily exactly the return type of eval(). In the case of plain matrices,
2012b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * the return type of eval() is a const reference to a matrix, not a matrix! It is however guaranteed
2022b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * that the return type of eval() is either PlainObject or const PlainObject&.
2032b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      */
2042b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    typedef typename internal::conditional<internal::is_same<typename internal::traits<Derived>::XprKind,MatrixXpr >::value,
2052b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang                                 PlainMatrix, PlainArray>::type PlainObject;
206c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
207c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** \returns the number of nonzero coefficients which is in practice the number
208c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      * of stored coefficients. */
2092b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
210c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    inline Index nonZeros() const { return size(); }
211c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
212c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** \returns the outer size.
213c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      *
214c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      * \note For a vector, this returns just 1. For a matrix (non-vector), this is the major dimension
215c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of columns for a
216c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      * column-major matrix, and the number of rows for a row-major matrix. */
2172b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
218c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Index outerSize() const
219c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
220c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      return IsVectorAtCompileTime ? 1
221c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath           : int(IsRowMajor) ? this->rows() : this->cols();
222c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
223c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
224c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** \returns the inner size.
225c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      *
226c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      * \note For a vector, this is just the size. For a matrix (non-vector), this is the minor dimension
227c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of rows for a
228c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      * column-major matrix, and the number of columns for a row-major matrix. */
2292b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
230c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Index innerSize() const
231c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
232c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      return IsVectorAtCompileTime ? this->size()
233c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath           : int(IsRowMajor) ? this->cols() : this->rows();
234c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
235c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
236c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods are
237c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does
238c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      * nothing else.
239c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      */
2402b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
2417faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez    void resize(Index newSize)
242c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
2437faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez      EIGEN_ONLY_USED_FOR_DEBUG(newSize);
2447faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez      eigen_assert(newSize == this->size()
245c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                && "DenseBase::resize() does not actually allow to resize.");
246c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
247c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods are
248c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does
249c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      * nothing else.
250c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      */
2512b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
2522b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    void resize(Index rows, Index cols)
253c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
2542b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      EIGEN_ONLY_USED_FOR_DEBUG(rows);
2552b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      EIGEN_ONLY_USED_FOR_DEBUG(cols);
2562b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      eigen_assert(rows == this->rows() && cols == this->cols()
257c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                && "DenseBase::resize() does not actually allow to resize.");
258c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
259c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
260c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#ifndef EIGEN_PARSED_BY_DOXYGEN
261c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** \internal Represents a matrix with all coefficients equal to one another*/
2622b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    typedef CwiseNullaryOp<internal::scalar_constant_op<Scalar>,PlainObject> ConstantReturnType;
2632b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /** \internal \deprecated Represents a vector with linearly spaced coefficients that allows sequential access only. */
2642b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    typedef CwiseNullaryOp<internal::linspaced_op<Scalar,PacketScalar>,PlainObject> SequentialLinSpacedReturnType;
265c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** \internal Represents a vector with linearly spaced coefficients that allows random access. */
2662b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    typedef CwiseNullaryOp<internal::linspaced_op<Scalar,PacketScalar>,PlainObject> RandomAccessLinSpacedReturnType;
267c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** \internal the return type of MatrixBase::eigenvalues() */
268c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef Matrix<typename NumTraits<typename internal::traits<Derived>::Scalar>::Real, internal::traits<Derived>::ColsAtCompileTime, 1> EigenvaluesReturnType;
269c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
270c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#endif // not EIGEN_PARSED_BY_DOXYGEN
271c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
272c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** Copies \a other into *this. \returns a reference to *this. */
273c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<typename OtherDerived>
2742b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
275c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Derived& operator=(const DenseBase<OtherDerived>& other);
276c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
277c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** Special case of the template operator=, in order to prevent the compiler
278c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      * from generating a default operator= (issue hit with g++ 4.1)
279c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      */
2802b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
281c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Derived& operator=(const DenseBase& other);
282c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
283c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<typename OtherDerived>
2842b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
285c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Derived& operator=(const EigenBase<OtherDerived> &other);
286c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
287c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<typename OtherDerived>
2882b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
289c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Derived& operator+=(const EigenBase<OtherDerived> &other);
290c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
291c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<typename OtherDerived>
2922b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
293c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Derived& operator-=(const EigenBase<OtherDerived> &other);
294c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
295c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<typename OtherDerived>
2962b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
297c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Derived& operator=(const ReturnByValue<OtherDerived>& func);
298c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
2992b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /** \ínternal
3002b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * Copies \a other into *this without evaluating other. \returns a reference to *this.
3012b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * \deprecated */
302c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<typename OtherDerived>
3032b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
304c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Derived& lazyAssign(const DenseBase<OtherDerived>& other);
305a829215e078ace896f52702caa0c27608f40e3b0Miao Wang
3062b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
307c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    CommaInitializer<Derived> operator<< (const Scalar& s);
308c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
3092b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /** \deprecated it now returns \c *this */
310c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<unsigned int Added,unsigned int Removed>
3112b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEPRECATED
3122b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    const Derived& flagged() const
3132b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    { return derived(); }
314c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
315c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<typename OtherDerived>
3162b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
317c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    CommaInitializer<Derived> operator<< (const DenseBase<OtherDerived>& other);
318c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
3192b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    typedef Transpose<Derived> TransposeReturnType;
3202b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
3212b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    TransposeReturnType transpose();
3222b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    typedef typename internal::add_const<Transpose<const Derived> >::type ConstTransposeReturnType;
3232b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
324c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    ConstTransposeReturnType transpose() const;
3252b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
326c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    void transposeInPlace();
327c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
3282b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC static const ConstantReturnType
329c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Constant(Index rows, Index cols, const Scalar& value);
3302b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC static const ConstantReturnType
331c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Constant(Index size, const Scalar& value);
3322b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC static const ConstantReturnType
333c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Constant(const Scalar& value);
334c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
3352b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC static const SequentialLinSpacedReturnType
336c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high);
3372b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType
338c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    LinSpaced(Index size, const Scalar& low, const Scalar& high);
3392b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC static const SequentialLinSpacedReturnType
340c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    LinSpaced(Sequential_t, const Scalar& low, const Scalar& high);
3412b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType
342c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    LinSpaced(const Scalar& low, const Scalar& high);
343c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
3442b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    template<typename CustomNullaryOp> EIGEN_DEVICE_FUNC
3452b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    static const CwiseNullaryOp<CustomNullaryOp, PlainObject>
346c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func);
3472b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    template<typename CustomNullaryOp> EIGEN_DEVICE_FUNC
3482b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    static const CwiseNullaryOp<CustomNullaryOp, PlainObject>
349c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    NullaryExpr(Index size, const CustomNullaryOp& func);
3502b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    template<typename CustomNullaryOp> EIGEN_DEVICE_FUNC
3512b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    static const CwiseNullaryOp<CustomNullaryOp, PlainObject>
352c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    NullaryExpr(const CustomNullaryOp& func);
353c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
3542b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(Index rows, Index cols);
3552b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(Index size);
3562b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC static const ConstantReturnType Zero();
3572b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(Index rows, Index cols);
3582b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(Index size);
3592b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC static const ConstantReturnType Ones();
3602b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang
3612b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC void fill(const Scalar& value);
3622b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC Derived& setConstant(const Scalar& value);
3632b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC Derived& setLinSpaced(Index size, const Scalar& low, const Scalar& high);
3642b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC Derived& setLinSpaced(const Scalar& low, const Scalar& high);
3652b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC Derived& setZero();
3662b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC Derived& setOnes();
3672b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC Derived& setRandom();
3682b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang
3692b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    template<typename OtherDerived> EIGEN_DEVICE_FUNC
370c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    bool isApprox(const DenseBase<OtherDerived>& other,
3717faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez                  const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
3722b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
373c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    bool isMuchSmallerThan(const RealScalar& other,
3747faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez                           const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
3752b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    template<typename OtherDerived> EIGEN_DEVICE_FUNC
376c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    bool isMuchSmallerThan(const DenseBase<OtherDerived>& other,
3777faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez                           const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
378c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
3792b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC bool isApproxToConstant(const Scalar& value, const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
3802b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC bool isConstant(const Scalar& value, const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
3812b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC bool isZero(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
3822b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC bool isOnes(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
3837faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez
3847faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez    inline bool hasNaN() const;
3857faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez    inline bool allFinite() const;
386c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
3872b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
3882b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    Derived& operator*=(const Scalar& other);
3892b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
3902b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    Derived& operator/=(const Scalar& other);
391c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
392c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef typename internal::add_const_on_value_type<typename internal::eval<Derived>::type>::type EvalReturnType;
393c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** \returns the matrix or vector obtained by evaluating this expression.
394c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      *
395c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      * Notice that in the case of a plain matrix or vector (not an expression) this function just returns
396c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      * a const reference, in order to avoid a useless copy.
3972b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      *
3982b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * \warning Be carefull with eval() and the auto C++ keyword, as detailed in this \link TopicPitfalls_auto_keyword page \endlink.
399c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      */
4002b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
401c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    EIGEN_STRONG_INLINE EvalReturnType eval() const
402c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
403c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      // Even though MSVC does not honor strong inlining when the return type
404c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      // is a dynamic matrix, we desperately need strong inlining for fixed
405c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      // size types on MSVC.
406c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      return typename internal::eval<Derived>::type(derived());
407c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
4082b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang
409c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** swaps *this with the expression \a other.
410c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      *
411c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      */
412c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<typename OtherDerived>
4132b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
4142b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    void swap(const DenseBase<OtherDerived>& other)
415c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
4162b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      EIGEN_STATIC_ASSERT(!OtherDerived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY);
4172b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      eigen_assert(rows()==other.rows() && cols()==other.cols());
4182b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      call_assignment(derived(), other.const_cast_derived(), internal::swap_assign_op<Scalar>());
419c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
420c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
421c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** swaps *this with the matrix or array \a other.
422c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      *
423c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      */
424c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<typename OtherDerived>
4252b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
426c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    void swap(PlainObjectBase<OtherDerived>& other)
427c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
4282b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      eigen_assert(rows()==other.rows() && cols()==other.cols());
4292b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      call_assignment(derived(), other.derived(), internal::swap_assign_op<Scalar>());
430c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
431c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
4322b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC inline const NestByValue<Derived> nestByValue() const;
4332b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC inline const ForceAlignedAccess<Derived> forceAlignedAccess() const;
4342b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC inline ForceAlignedAccess<Derived> forceAlignedAccess();
4352b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    template<bool Enable> EIGEN_DEVICE_FUNC
4362b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    inline const typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf() const;
4372b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    template<bool Enable> EIGEN_DEVICE_FUNC
4382b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf();
439c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
4402b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC Scalar sum() const;
4412b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC Scalar mean() const;
4422b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC Scalar trace() const;
443c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
4442b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC Scalar prod() const;
445c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
4462b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar minCoeff() const;
4472b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar maxCoeff() const;
448c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
4492b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    template<typename IndexType> EIGEN_DEVICE_FUNC
450c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typename internal::traits<Derived>::Scalar minCoeff(IndexType* row, IndexType* col) const;
4512b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    template<typename IndexType> EIGEN_DEVICE_FUNC
452c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typename internal::traits<Derived>::Scalar maxCoeff(IndexType* row, IndexType* col) const;
4532b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    template<typename IndexType> EIGEN_DEVICE_FUNC
454c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typename internal::traits<Derived>::Scalar minCoeff(IndexType* index) const;
4552b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    template<typename IndexType> EIGEN_DEVICE_FUNC
456c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typename internal::traits<Derived>::Scalar maxCoeff(IndexType* index) const;
457c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
458c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<typename BinaryOp>
4592b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
4602b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    Scalar redux(const BinaryOp& func) const;
461c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
462c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<typename Visitor>
4632b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
464c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    void visit(Visitor& func) const;
465c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
4662b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /** \returns a WithFormat proxy object allowing to print a matrix the with given
4672b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * format \a fmt.
4682b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      *
4692b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * See class IOFormat for some examples.
4702b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      *
4712b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      * \sa class IOFormat, class WithFormat
4722b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      */
4732b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    inline const WithFormat<Derived> format(const IOFormat& fmt) const
4742b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    {
4752b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      return WithFormat<Derived>(derived(), fmt);
4762b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    }
477c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
478c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** \returns the unique coefficient of a 1x1 expression */
4792b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
480c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    CoeffReturnType value() const
481c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
482c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      EIGEN_STATIC_ASSERT_SIZE_1x1(Derived)
483c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      eigen_assert(this->rows() == 1 && this->cols() == 1);
484c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      return derived().coeff(0,0);
485c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
486c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
4872b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    bool all() const;
4882b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    bool any() const;
489c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Index count() const;
490c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
491c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef VectorwiseOp<Derived, Horizontal> RowwiseReturnType;
492c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef const VectorwiseOp<const Derived, Horizontal> ConstRowwiseReturnType;
493c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef VectorwiseOp<Derived, Vertical> ColwiseReturnType;
494c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef const VectorwiseOp<const Derived, Vertical> ConstColwiseReturnType;
495c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
4962b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /** \returns a VectorwiseOp wrapper of *this providing additional partial reduction operations
4972b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    *
4982b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    * Example: \include MatrixBase_rowwise.cpp
4992b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    * Output: \verbinclude MatrixBase_rowwise.out
5002b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    *
5012b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    * \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
5022b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    */
5032b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    //Code moved here due to a CUDA compiler bug
5042b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC inline ConstRowwiseReturnType rowwise() const {
5052b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      return ConstRowwiseReturnType(derived());
5062b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    }
5072b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC RowwiseReturnType rowwise();
5082b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang
5092b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /** \returns a VectorwiseOp wrapper of *this providing additional partial reduction operations
5102b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    *
5112b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    * Example: \include MatrixBase_colwise.cpp
5122b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    * Output: \verbinclude MatrixBase_colwise.out
5132b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    *
5142b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    * \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
5152b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    */
5162b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC inline ConstColwiseReturnType colwise() const {
5172b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      return ConstColwiseReturnType(derived());
5182b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    }
5192b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC ColwiseReturnType colwise();
520c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
5212b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    typedef CwiseNullaryOp<internal::scalar_random_op<Scalar>,PlainObject> RandomReturnType;
5222b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    static const RandomReturnType Random(Index rows, Index cols);
5232b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    static const RandomReturnType Random(Index size);
5242b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    static const RandomReturnType Random();
525c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
526c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<typename ThenDerived,typename ElseDerived>
527c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    const Select<Derived,ThenDerived,ElseDerived>
528c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    select(const DenseBase<ThenDerived>& thenMatrix,
529c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath           const DenseBase<ElseDerived>& elseMatrix) const;
530c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
531c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<typename ThenDerived>
532c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    inline const Select<Derived,ThenDerived, typename ThenDerived::ConstantReturnType>
5337faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez    select(const DenseBase<ThenDerived>& thenMatrix, const typename ThenDerived::Scalar& elseScalar) const;
534c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
535c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<typename ElseDerived>
536c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    inline const Select<Derived, typename ElseDerived::ConstantReturnType, ElseDerived >
5377faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez    select(const typename ElseDerived::Scalar& thenScalar, const DenseBase<ElseDerived>& elseMatrix) const;
538c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
539c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<int p> RealScalar lpNorm() const;
540c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
541c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    template<int RowFactor, int ColFactor>
5422b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
5432b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    const Replicate<Derived,RowFactor,ColFactor> replicate() const;
5442b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /**
5452b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    * \return an expression of the replication of \c *this
5462b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    *
5472b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    * Example: \include MatrixBase_replicate_int_int.cpp
5482b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    * Output: \verbinclude MatrixBase_replicate_int_int.out
5492b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    *
5502b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    * \sa VectorwiseOp::replicate(), DenseBase::replicate<int,int>(), class Replicate
5512b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    */
5522b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    //Code moved here due to a CUDA compiler bug
5532b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
5542b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    const Replicate<Derived, Dynamic, Dynamic> replicate(Index rowFactor, Index colFactor) const
5552b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    {
5562b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      return Replicate<Derived, Dynamic, Dynamic>(derived(), rowFactor, colFactor);
5572b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    }
558c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
559c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef Reverse<Derived, BothDirections> ReverseReturnType;
560c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef const Reverse<const Derived, BothDirections> ConstReverseReturnType;
5612b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC ReverseReturnType reverse();
5622b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    /** This is the const version of reverse(). */
5632b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    //Code moved here due to a CUDA compiler bug
5642b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC ConstReverseReturnType reverse() const
5652b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    {
5662b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang      return ConstReverseReturnType(derived());
5672b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    }
5682b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC void reverseInPlace();
569c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
570c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase
5712b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang#define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
5722b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang#define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND)
573c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#   include "../plugins/BlockMethods.h"
574c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#   ifdef EIGEN_DENSEBASE_PLUGIN
575c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#     include EIGEN_DENSEBASE_PLUGIN
576c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#   endif
577c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
5782b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang#undef EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
5792b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang#undef EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF
580c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
581c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    // disable the use of evalTo for dense objects with a nice compilation error
5822b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    template<typename Dest>
5832b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC
5842b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    inline void evalTo(Dest& ) const
585c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
586c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      EIGEN_STATIC_ASSERT((internal::is_same<Dest,void>::value),THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS);
587c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
588c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
589c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  protected:
590c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** Default constructor. Do nothing. */
5912b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC DenseBase()
592c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
593c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      /* Just checks for self-consistency of the flags.
594c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath       * Only do it when debugging Eigen, as this borders on paranoiac and could slow compilation down
595c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath       */
596c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#ifdef EIGEN_INTERNAL_DEBUGGING
597c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, int(IsRowMajor))
598c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                        && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, int(!IsRowMajor))),
599c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                          INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION)
600c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#endif
601c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
602c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
603c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  private:
6042b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC explicit DenseBase(int);
6052b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    EIGEN_DEVICE_FUNC DenseBase(int,int);
6062b8756b6f1de65d3f8bffab45be6c44ceb7411fcMiao Wang    template<typename OtherDerived> EIGEN_DEVICE_FUNC explicit DenseBase(const DenseBase<OtherDerived>&);
607c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath};
608c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
609c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath} // end namespace Eigen
610c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
611c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#endif // EIGEN_DENSEBASE_H
612