2009-12-04 23:17:14 +01:00
|
|
|
// This file is part of Eigen, a lightweight C++ template library
|
|
|
|
|
// for linear algebra.
|
|
|
|
|
//
|
2010-04-23 11:36:22 -04:00
|
|
|
// Copyright (C) 2007-2010 Benoit Jacob <jacob.benoit.1@gmail.com>
|
2010-06-24 23:21:58 +02:00
|
|
|
// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
|
2009-12-04 23:17:14 +01:00
|
|
|
//
|
2012-07-13 14:42:47 -04:00
|
|
|
// This Source Code Form is subject to the terms of the Mozilla
|
|
|
|
|
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
|
|
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2009-12-04 23:17:14 +01:00
|
|
|
|
|
|
|
|
#ifndef EIGEN_DENSEBASE_H
|
|
|
|
|
#define EIGEN_DENSEBASE_H
|
|
|
|
|
|
2021-09-10 19:12:26 +00:00
|
|
|
#include "./InternalHeaderCheck.h"
|
|
|
|
|
|
2012-04-15 11:06:28 +01:00
|
|
|
namespace Eigen {
|
|
|
|
|
|
2013-06-10 17:16:16 +02:00
|
|
|
// The index type defined by EIGEN_DEFAULT_DENSE_INDEX_TYPE must be a signed type.
|
2021-09-16 20:43:54 +00:00
|
|
|
EIGEN_STATIC_ASSERT(NumTraits<DenseIndex>::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE)
|
2021-03-08 12:39:11 -05:00
|
|
|
|
2009-12-04 23:17:14 +01:00
|
|
|
/** \class DenseBase
|
2010-07-06 13:10:08 +01:00
|
|
|
* \ingroup Core_Module
|
2009-12-04 23:17:14 +01:00
|
|
|
*
|
|
|
|
|
* \brief Base class for all dense matrices, vectors, and arrays
|
|
|
|
|
*
|
2010-01-04 19:00:16 +01:00
|
|
|
* This class is the base that is inherited by all dense objects (matrix, vector, arrays,
|
|
|
|
|
* and related expression types). The common Eigen API for dense objects is contained in this class.
|
2009-12-04 23:17:14 +01:00
|
|
|
*
|
2011-02-13 22:50:57 +00:00
|
|
|
* \tparam Derived is the derived type, e.g., a matrix type or an expression.
|
|
|
|
|
*
|
|
|
|
|
* This class can be extended with the help of the plugin mechanism described on the page
|
2016-08-30 11:10:08 +02:00
|
|
|
* \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_DENSEBASE_PLUGIN.
|
2010-08-22 18:28:19 +01:00
|
|
|
*
|
2015-12-30 16:45:44 +01:00
|
|
|
* \sa \blank \ref TopicClassHierarchy
|
2009-12-04 23:17:14 +01:00
|
|
|
*/
|
|
|
|
|
template<typename Derived> class DenseBase
|
|
|
|
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
2019-02-07 15:21:35 +01:00
|
|
|
: public DenseCoeffsBase<Derived, internal::accessors_level<Derived>::value>
|
2010-01-04 19:00:16 +01:00
|
|
|
#else
|
2016-06-01 09:38:49 +02:00
|
|
|
: public DenseCoeffsBase<Derived,DirectWriteAccessors>
|
2009-12-04 23:17:14 +01:00
|
|
|
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
|
|
|
|
{
|
|
|
|
|
public:
|
2014-09-29 13:36:57 +02:00
|
|
|
|
|
|
|
|
/** Inner iterator type to iterate over the coefficients of a row or column.
|
|
|
|
|
* \sa class InnerIterator
|
|
|
|
|
*/
|
2014-09-29 18:28:18 +02:00
|
|
|
typedef Eigen::InnerIterator<Derived> InnerIterator;
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2010-10-25 10:15:22 -04:00
|
|
|
typedef typename internal::traits<Derived>::StorageKind StorageKind;
|
2011-03-11 11:15:44 +00:00
|
|
|
|
2014-12-04 22:48:53 +01:00
|
|
|
/**
|
2015-02-13 18:57:41 +01:00
|
|
|
* \brief The type used to store indices
|
|
|
|
|
* \details This typedef is relevant for types that store multiple indices such as
|
|
|
|
|
* PermutationMatrix or Transpositions, otherwise it defaults to Eigen::Index
|
2015-12-30 16:45:44 +01:00
|
|
|
* \sa \blank \ref TopicPreprocessorDirectives, Eigen::Index, SparseMatrixBase.
|
2014-12-04 22:48:53 +01:00
|
|
|
*/
|
|
|
|
|
typedef typename internal::traits<Derived>::StorageIndex StorageIndex;
|
2011-03-11 11:15:44 +00:00
|
|
|
|
2015-04-24 09:44:24 +02:00
|
|
|
/** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc. */
|
2010-10-25 10:15:22 -04:00
|
|
|
typedef typename internal::traits<Derived>::Scalar Scalar;
|
2021-03-08 12:39:11 -05:00
|
|
|
|
2015-04-24 09:44:24 +02:00
|
|
|
/** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc.
|
|
|
|
|
*
|
|
|
|
|
* It is an alias for the Scalar type */
|
|
|
|
|
typedef Scalar value_type;
|
2021-03-08 12:39:11 -05:00
|
|
|
|
2010-05-30 16:00:58 -04:00
|
|
|
typedef typename NumTraits<Scalar>::Real RealScalar;
|
2019-02-07 15:21:35 +01:00
|
|
|
typedef DenseCoeffsBase<Derived, internal::accessors_level<Derived>::value> Base;
|
2010-05-30 16:00:58 -04:00
|
|
|
|
2010-05-08 13:45:31 -04:00
|
|
|
using Base::derived;
|
|
|
|
|
using Base::const_cast_derived;
|
|
|
|
|
using Base::rows;
|
|
|
|
|
using Base::cols;
|
|
|
|
|
using Base::size;
|
|
|
|
|
using Base::rowIndexByOuterInner;
|
|
|
|
|
using Base::colIndexByOuterInner;
|
|
|
|
|
using Base::coeff;
|
|
|
|
|
using Base::coeffByOuterInner;
|
|
|
|
|
using Base::operator();
|
|
|
|
|
using Base::operator[];
|
|
|
|
|
using Base::x;
|
|
|
|
|
using Base::y;
|
|
|
|
|
using Base::z;
|
|
|
|
|
using Base::w;
|
2010-05-08 16:00:05 -04:00
|
|
|
using Base::stride;
|
|
|
|
|
using Base::innerStride;
|
|
|
|
|
using Base::outerStride;
|
|
|
|
|
using Base::rowStride;
|
|
|
|
|
using Base::colStride;
|
2010-08-25 13:34:35 +02:00
|
|
|
typedef typename Base::CoeffReturnType CoeffReturnType;
|
2009-12-16 19:18:40 +01:00
|
|
|
|
2009-12-04 23:17:14 +01:00
|
|
|
enum {
|
|
|
|
|
|
2010-10-25 10:15:22 -04:00
|
|
|
RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
|
2009-12-04 23:17:14 +01:00
|
|
|
/**< The number of rows at compile-time. This is just a copy of the value provided
|
|
|
|
|
* by the \a Derived type. If a value is not known at compile-time,
|
|
|
|
|
* it is set to the \a Dynamic constant.
|
|
|
|
|
* \sa MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime */
|
|
|
|
|
|
2010-10-25 10:15:22 -04:00
|
|
|
ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
|
2009-12-04 23:17:14 +01:00
|
|
|
/**< The number of columns at compile-time. This is just a copy of the value provided
|
|
|
|
|
* by the \a Derived type. If a value is not known at compile-time,
|
|
|
|
|
* it is set to the \a Dynamic constant.
|
|
|
|
|
* \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */
|
|
|
|
|
|
|
|
|
|
|
2022-04-04 18:38:34 +00:00
|
|
|
SizeAtCompileTime = (internal::size_of_xpr_at_compile_time<Derived>::ret),
|
2009-12-04 23:17:14 +01:00
|
|
|
/**< This is equal to the number of coefficients, i.e. the number of
|
|
|
|
|
* rows times the number of columns, or to \a Dynamic if this is not
|
|
|
|
|
* known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
|
|
|
|
|
|
2010-10-25 10:15:22 -04:00
|
|
|
MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime,
|
2009-12-04 23:17:14 +01:00
|
|
|
/**< This value is equal to the maximum possible number of rows that this expression
|
|
|
|
|
* might have. If this expression might have an arbitrarily high number of rows,
|
|
|
|
|
* this value is set to \a Dynamic.
|
|
|
|
|
*
|
|
|
|
|
* This value is useful to know when evaluating an expression, in order to determine
|
|
|
|
|
* whether it is possible to avoid doing a dynamic memory allocation.
|
|
|
|
|
*
|
|
|
|
|
* \sa RowsAtCompileTime, MaxColsAtCompileTime, MaxSizeAtCompileTime
|
|
|
|
|
*/
|
|
|
|
|
|
2010-10-25 10:15:22 -04:00
|
|
|
MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime,
|
2009-12-04 23:17:14 +01:00
|
|
|
/**< This value is equal to the maximum possible number of columns that this expression
|
|
|
|
|
* might have. If this expression might have an arbitrarily high number of columns,
|
|
|
|
|
* this value is set to \a Dynamic.
|
|
|
|
|
*
|
|
|
|
|
* This value is useful to know when evaluating an expression, in order to determine
|
|
|
|
|
* whether it is possible to avoid doing a dynamic memory allocation.
|
|
|
|
|
*
|
|
|
|
|
* \sa ColsAtCompileTime, MaxRowsAtCompileTime, MaxSizeAtCompileTime
|
|
|
|
|
*/
|
|
|
|
|
|
2022-04-04 18:38:34 +00:00
|
|
|
MaxSizeAtCompileTime = (internal::size_of_xpr_at_compile_time<Derived>::ret),
|
2009-12-04 23:17:14 +01:00
|
|
|
/**< This value is equal to the maximum possible number of coefficients that this expression
|
|
|
|
|
* might have. If this expression might have an arbitrarily high number of coefficients,
|
|
|
|
|
* this value is set to \a Dynamic.
|
|
|
|
|
*
|
|
|
|
|
* This value is useful to know when evaluating an expression, in order to determine
|
|
|
|
|
* whether it is possible to avoid doing a dynamic memory allocation.
|
|
|
|
|
*
|
|
|
|
|
* \sa SizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime
|
|
|
|
|
*/
|
|
|
|
|
|
2019-01-15 15:09:49 +01:00
|
|
|
IsVectorAtCompileTime = internal::traits<Derived>::RowsAtCompileTime == 1
|
|
|
|
|
|| internal::traits<Derived>::ColsAtCompileTime == 1,
|
2009-12-04 23:17:14 +01:00
|
|
|
/**< This is set to true if either the number of rows or the number of
|
|
|
|
|
* columns is known at compile-time to be equal to 1. Indeed, in that case,
|
|
|
|
|
* we are dealing with a column-vector (if there is only one column) or with
|
|
|
|
|
* a row-vector (if there is only one row). */
|
|
|
|
|
|
2018-06-08 16:50:17 +02:00
|
|
|
NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0 : bool(IsVectorAtCompileTime) ? 1 : 2,
|
2021-03-08 12:39:11 -05:00
|
|
|
/**< This value is equal to Tensor::NumDimensions, i.e. 0 for scalars, 1 for vectors,
|
2018-06-08 16:50:17 +02:00
|
|
|
* and 2 for matrices.
|
|
|
|
|
*/
|
|
|
|
|
|
2010-10-25 10:15:22 -04:00
|
|
|
Flags = internal::traits<Derived>::Flags,
|
2009-12-04 23:17:14 +01:00
|
|
|
/**< This stores expression \ref flags flags which may or may not be inherited by new expressions
|
|
|
|
|
* constructed from this one. See the \ref flags "list of flags".
|
|
|
|
|
*/
|
|
|
|
|
|
2010-03-09 00:16:07 -05:00
|
|
|
IsRowMajor = int(Flags) & RowMajorBit, /**< True if this expression has row-major storage order. */
|
2010-02-25 21:01:52 -05:00
|
|
|
|
2012-03-22 00:01:03 +01:00
|
|
|
InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? int(SizeAtCompileTime)
|
|
|
|
|
: int(IsRowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime),
|
2010-02-25 21:01:52 -05:00
|
|
|
|
2010-10-25 10:15:22 -04:00
|
|
|
InnerStrideAtCompileTime = internal::inner_stride_at_compile_time<Derived>::ret,
|
|
|
|
|
OuterStrideAtCompileTime = internal::outer_stride_at_compile_time<Derived>::ret
|
2009-12-04 23:17:14 +01:00
|
|
|
};
|
2021-03-08 12:39:11 -05:00
|
|
|
|
2015-08-07 20:05:31 +02:00
|
|
|
typedef typename internal::find_best_packet<Scalar,SizeAtCompileTime>::type PacketScalar;
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2014-11-06 09:25:26 +01:00
|
|
|
enum { IsPlainObjectBase = 0 };
|
2021-03-08 12:39:11 -05:00
|
|
|
|
2015-06-22 10:52:08 +02:00
|
|
|
/** The plain matrix type corresponding to this expression.
|
|
|
|
|
* \sa PlainObject */
|
|
|
|
|
typedef Matrix<typename internal::traits<Derived>::Scalar,
|
|
|
|
|
internal::traits<Derived>::RowsAtCompileTime,
|
|
|
|
|
internal::traits<Derived>::ColsAtCompileTime,
|
|
|
|
|
AutoAlign | (internal::traits<Derived>::Flags&RowMajorBit ? RowMajor : ColMajor),
|
|
|
|
|
internal::traits<Derived>::MaxRowsAtCompileTime,
|
|
|
|
|
internal::traits<Derived>::MaxColsAtCompileTime
|
|
|
|
|
> PlainMatrix;
|
2021-03-08 12:39:11 -05:00
|
|
|
|
2015-06-22 10:52:08 +02:00
|
|
|
/** The plain array type corresponding to this expression.
|
|
|
|
|
* \sa PlainObject */
|
|
|
|
|
typedef Array<typename internal::traits<Derived>::Scalar,
|
|
|
|
|
internal::traits<Derived>::RowsAtCompileTime,
|
|
|
|
|
internal::traits<Derived>::ColsAtCompileTime,
|
|
|
|
|
AutoAlign | (internal::traits<Derived>::Flags&RowMajorBit ? RowMajor : ColMajor),
|
|
|
|
|
internal::traits<Derived>::MaxRowsAtCompileTime,
|
|
|
|
|
internal::traits<Derived>::MaxColsAtCompileTime
|
|
|
|
|
> PlainArray;
|
|
|
|
|
|
|
|
|
|
/** \brief The plain matrix or array type corresponding to this expression.
|
|
|
|
|
*
|
|
|
|
|
* This is not necessarily exactly the return type of eval(). In the case of plain matrices,
|
|
|
|
|
* the return type of eval() is a const reference to a matrix, not a matrix! It is however guaranteed
|
|
|
|
|
* that the return type of eval() is either PlainObject or const PlainObject&.
|
|
|
|
|
*/
|
2022-03-16 16:43:40 +00:00
|
|
|
typedef std::conditional_t<internal::is_same<typename internal::traits<Derived>::XprKind,MatrixXpr >::value,
|
|
|
|
|
PlainMatrix, PlainArray> PlainObject;
|
2010-12-22 17:45:37 -05:00
|
|
|
|
2010-02-18 20:42:38 -05:00
|
|
|
/** \returns the outer size.
|
|
|
|
|
*
|
|
|
|
|
* \note For a vector, this returns just 1. For a matrix (non-vector), this is the major dimension
|
2011-02-12 17:43:29 +00:00
|
|
|
* with respect to the \ref TopicStorageOrders "storage order", i.e., the number of columns for a
|
|
|
|
|
* column-major matrix, and the number of rows for a row-major matrix. */
|
2021-03-08 12:39:11 -05:00
|
|
|
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
2010-05-30 16:00:58 -04:00
|
|
|
Index outerSize() const
|
2010-02-18 20:42:38 -05:00
|
|
|
{
|
|
|
|
|
return IsVectorAtCompileTime ? 1
|
2010-04-16 10:13:32 -04:00
|
|
|
: int(IsRowMajor) ? this->rows() : this->cols();
|
2010-02-18 20:42:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \returns the inner size.
|
|
|
|
|
*
|
|
|
|
|
* \note For a vector, this is just the size. For a matrix (non-vector), this is the minor dimension
|
2021-03-08 12:39:11 -05:00
|
|
|
* with respect to the \ref TopicStorageOrders "storage order", i.e., the number of rows for a
|
2011-02-12 17:43:29 +00:00
|
|
|
* column-major matrix, and the number of columns for a row-major matrix. */
|
2021-03-08 12:39:11 -05:00
|
|
|
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
|
2010-05-30 16:00:58 -04:00
|
|
|
Index innerSize() const
|
2010-02-18 20:42:38 -05:00
|
|
|
{
|
|
|
|
|
return IsVectorAtCompileTime ? this->size()
|
2010-04-16 10:13:32 -04:00
|
|
|
: int(IsRowMajor) ? this->cols() : this->rows();
|
2010-02-18 20:42:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods are
|
|
|
|
|
* Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does
|
2009-12-04 23:17:14 +01:00
|
|
|
* nothing else.
|
|
|
|
|
*/
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2012-06-22 16:32:45 +02:00
|
|
|
void resize(Index newSize)
|
2009-12-04 23:17:14 +01:00
|
|
|
{
|
2012-06-22 16:32:45 +02:00
|
|
|
EIGEN_ONLY_USED_FOR_DEBUG(newSize);
|
|
|
|
|
eigen_assert(newSize == this->size()
|
2010-02-18 20:42:38 -05:00
|
|
|
&& "DenseBase::resize() does not actually allow to resize.");
|
2009-12-04 23:17:14 +01:00
|
|
|
}
|
2010-02-18 20:42:38 -05:00
|
|
|
/** Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods are
|
|
|
|
|
* Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does
|
2009-12-04 23:17:14 +01:00
|
|
|
* nothing else.
|
|
|
|
|
*/
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2015-06-09 13:32:12 +02:00
|
|
|
void resize(Index rows, Index cols)
|
2009-12-04 23:17:14 +01:00
|
|
|
{
|
2015-06-09 13:32:12 +02:00
|
|
|
EIGEN_ONLY_USED_FOR_DEBUG(rows);
|
|
|
|
|
EIGEN_ONLY_USED_FOR_DEBUG(cols);
|
|
|
|
|
eigen_assert(rows == this->rows() && cols == this->cols()
|
2010-02-18 20:42:38 -05:00
|
|
|
&& "DenseBase::resize() does not actually allow to resize.");
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-04 23:17:14 +01:00
|
|
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
|
|
|
|
/** \internal Represents a matrix with all coefficients equal to one another*/
|
2015-06-22 10:52:08 +02:00
|
|
|
typedef CwiseNullaryOp<internal::scalar_constant_op<Scalar>,PlainObject> ConstantReturnType;
|
2016-10-24 20:27:21 +02:00
|
|
|
/** \internal \deprecated Represents a vector with linearly spaced coefficients that allows sequential access only. */
|
2019-04-23 17:23:19 -07:00
|
|
|
EIGEN_DEPRECATED typedef CwiseNullaryOp<internal::linspaced_op<Scalar>,PlainObject> SequentialLinSpacedReturnType;
|
2010-01-26 19:42:17 +01:00
|
|
|
/** \internal Represents a vector with linearly spaced coefficients that allows random access. */
|
2018-11-28 13:15:06 +01:00
|
|
|
typedef CwiseNullaryOp<internal::linspaced_op<Scalar>,PlainObject> RandomAccessLinSpacedReturnType;
|
2009-12-04 23:17:14 +01:00
|
|
|
/** \internal the return type of MatrixBase::eigenvalues() */
|
2010-10-25 10:15:22 -04:00
|
|
|
typedef Matrix<typename NumTraits<typename internal::traits<Derived>::Scalar>::Real, internal::traits<Derived>::ColsAtCompileTime, 1> EigenvaluesReturnType;
|
2010-06-02 09:45:57 +02:00
|
|
|
|
2009-12-04 23:17:14 +01:00
|
|
|
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
|
|
|
|
|
|
|
|
|
/** Copies \a other into *this. \returns a reference to *this. */
|
|
|
|
|
template<typename OtherDerived>
|
2016-01-31 16:34:10 +01:00
|
|
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
2009-12-04 23:17:14 +01:00
|
|
|
Derived& operator=(const DenseBase<OtherDerived>& other);
|
|
|
|
|
|
|
|
|
|
/** Special case of the template operator=, in order to prevent the compiler
|
|
|
|
|
* from generating a default operator= (issue hit with g++ 4.1)
|
|
|
|
|
*/
|
2016-01-31 16:34:10 +01:00
|
|
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
2009-12-04 23:17:14 +01:00
|
|
|
Derived& operator=(const DenseBase& other);
|
|
|
|
|
|
|
|
|
|
template<typename OtherDerived>
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2010-02-20 15:26:02 +01:00
|
|
|
Derived& operator=(const EigenBase<OtherDerived> &other);
|
2009-12-04 23:17:14 +01:00
|
|
|
|
|
|
|
|
template<typename OtherDerived>
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2010-02-20 15:26:02 +01:00
|
|
|
Derived& operator+=(const EigenBase<OtherDerived> &other);
|
2009-12-04 23:17:14 +01:00
|
|
|
|
|
|
|
|
template<typename OtherDerived>
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2010-02-20 15:26:02 +01:00
|
|
|
Derived& operator-=(const EigenBase<OtherDerived> &other);
|
2009-12-04 23:17:14 +01:00
|
|
|
|
|
|
|
|
template<typename OtherDerived>
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2009-12-04 23:17:14 +01:00
|
|
|
Derived& operator=(const ReturnByValue<OtherDerived>& func);
|
|
|
|
|
|
2017-03-07 10:53:47 +01:00
|
|
|
/** \internal
|
2019-04-24 12:42:28 -07:00
|
|
|
* Copies \a other into *this without evaluating other. \returns a reference to *this. */
|
2009-12-04 23:17:14 +01:00
|
|
|
template<typename OtherDerived>
|
2019-04-24 12:42:28 -07:00
|
|
|
/** \deprecated */
|
2019-04-23 17:23:19 -07:00
|
|
|
EIGEN_DEPRECATED EIGEN_DEVICE_FUNC
|
2009-12-04 23:17:14 +01:00
|
|
|
Derived& lazyAssign(const DenseBase<OtherDerived>& other);
|
|
|
|
|
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2009-12-04 23:17:14 +01:00
|
|
|
CommaInitializer<Derived> operator<< (const Scalar& s);
|
|
|
|
|
|
2014-02-19 14:05:56 +01:00
|
|
|
template<unsigned int Added,unsigned int Removed>
|
2019-04-24 12:42:28 -07:00
|
|
|
/** \deprecated it now returns \c *this */
|
2014-09-23 14:28:23 +02:00
|
|
|
EIGEN_DEPRECATED
|
2014-02-19 14:05:56 +01:00
|
|
|
const Derived& flagged() const
|
|
|
|
|
{ return derived(); }
|
2010-02-05 23:44:24 +01:00
|
|
|
|
2009-12-04 23:17:14 +01:00
|
|
|
template<typename OtherDerived>
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2009-12-04 23:17:14 +01:00
|
|
|
CommaInitializer<Derived> operator<< (const DenseBase<OtherDerived>& other);
|
|
|
|
|
|
2014-09-23 14:28:23 +02:00
|
|
|
typedef Transpose<Derived> TransposeReturnType;
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2014-09-23 14:28:23 +02:00
|
|
|
TransposeReturnType transpose();
|
2022-03-16 16:43:40 +00:00
|
|
|
typedef const Transpose<const Derived> ConstTransposeReturnType;
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2010-12-22 17:45:37 -05:00
|
|
|
ConstTransposeReturnType transpose() const;
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2009-12-04 23:17:14 +01:00
|
|
|
void transposeInPlace();
|
|
|
|
|
|
2013-06-05 15:38:33 +02:00
|
|
|
EIGEN_DEVICE_FUNC static const ConstantReturnType
|
2010-05-30 16:00:58 -04:00
|
|
|
Constant(Index rows, Index cols, const Scalar& value);
|
2013-06-05 15:38:33 +02:00
|
|
|
EIGEN_DEVICE_FUNC static const ConstantReturnType
|
2010-05-30 16:00:58 -04:00
|
|
|
Constant(Index size, const Scalar& value);
|
2013-06-05 15:38:33 +02:00
|
|
|
EIGEN_DEVICE_FUNC static const ConstantReturnType
|
2009-12-04 23:17:14 +01:00
|
|
|
Constant(const Scalar& value);
|
|
|
|
|
|
2019-04-24 11:01:35 -07:00
|
|
|
EIGEN_DEPRECATED EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType
|
2010-07-22 14:04:00 +02:00
|
|
|
LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high);
|
2019-04-24 11:01:35 -07:00
|
|
|
EIGEN_DEPRECATED EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType
|
|
|
|
|
LinSpaced(Sequential_t, const Scalar& low, const Scalar& high);
|
|
|
|
|
|
2013-06-05 15:38:33 +02:00
|
|
|
EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType
|
2010-07-22 14:04:00 +02:00
|
|
|
LinSpaced(Index size, const Scalar& low, const Scalar& high);
|
2013-06-05 15:38:33 +02:00
|
|
|
EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType
|
2010-07-22 14:04:00 +02:00
|
|
|
LinSpaced(const Scalar& low, const Scalar& high);
|
2010-01-26 19:42:17 +01:00
|
|
|
|
2013-06-05 15:38:33 +02:00
|
|
|
template<typename CustomNullaryOp> EIGEN_DEVICE_FUNC
|
2015-06-22 10:52:08 +02:00
|
|
|
static const CwiseNullaryOp<CustomNullaryOp, PlainObject>
|
2010-05-30 16:00:58 -04:00
|
|
|
NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func);
|
2013-06-05 15:38:33 +02:00
|
|
|
template<typename CustomNullaryOp> EIGEN_DEVICE_FUNC
|
2015-06-22 10:52:08 +02:00
|
|
|
static const CwiseNullaryOp<CustomNullaryOp, PlainObject>
|
2010-05-30 16:00:58 -04:00
|
|
|
NullaryExpr(Index size, const CustomNullaryOp& func);
|
2013-06-05 15:38:33 +02:00
|
|
|
template<typename CustomNullaryOp> EIGEN_DEVICE_FUNC
|
2015-06-22 10:52:08 +02:00
|
|
|
static const CwiseNullaryOp<CustomNullaryOp, PlainObject>
|
2009-12-04 23:17:14 +01:00
|
|
|
NullaryExpr(const CustomNullaryOp& func);
|
|
|
|
|
|
2013-06-05 15:38:33 +02:00
|
|
|
EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(Index rows, Index cols);
|
|
|
|
|
EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(Index size);
|
|
|
|
|
EIGEN_DEVICE_FUNC static const ConstantReturnType Zero();
|
|
|
|
|
EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(Index rows, Index cols);
|
|
|
|
|
EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(Index size);
|
|
|
|
|
EIGEN_DEVICE_FUNC static const ConstantReturnType Ones();
|
|
|
|
|
|
|
|
|
|
EIGEN_DEVICE_FUNC void fill(const Scalar& value);
|
|
|
|
|
EIGEN_DEVICE_FUNC Derived& setConstant(const Scalar& value);
|
|
|
|
|
EIGEN_DEVICE_FUNC Derived& setLinSpaced(Index size, const Scalar& low, const Scalar& high);
|
|
|
|
|
EIGEN_DEVICE_FUNC Derived& setLinSpaced(const Scalar& low, const Scalar& high);
|
|
|
|
|
EIGEN_DEVICE_FUNC Derived& setZero();
|
|
|
|
|
EIGEN_DEVICE_FUNC Derived& setOnes();
|
|
|
|
|
EIGEN_DEVICE_FUNC Derived& setRandom();
|
|
|
|
|
|
|
|
|
|
template<typename OtherDerived> EIGEN_DEVICE_FUNC
|
2009-12-04 23:17:14 +01:00
|
|
|
bool isApprox(const DenseBase<OtherDerived>& other,
|
2012-06-28 02:08:59 +02:00
|
|
|
const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
|
2019-04-24 11:01:35 -07:00
|
|
|
EIGEN_DEVICE_FUNC
|
2009-12-04 23:17:14 +01:00
|
|
|
bool isMuchSmallerThan(const RealScalar& other,
|
2012-06-28 02:08:59 +02:00
|
|
|
const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
|
2013-06-05 15:38:33 +02:00
|
|
|
template<typename OtherDerived> EIGEN_DEVICE_FUNC
|
2009-12-04 23:17:14 +01:00
|
|
|
bool isMuchSmallerThan(const DenseBase<OtherDerived>& other,
|
2012-06-28 02:08:59 +02:00
|
|
|
const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2013-06-05 15:38:33 +02:00
|
|
|
EIGEN_DEVICE_FUNC bool isApproxToConstant(const Scalar& value, const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
|
|
|
|
|
EIGEN_DEVICE_FUNC bool isConstant(const Scalar& value, const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
|
|
|
|
|
EIGEN_DEVICE_FUNC bool isZero(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
|
|
|
|
|
EIGEN_DEVICE_FUNC bool isOnes(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
|
2019-04-24 11:01:35 -07:00
|
|
|
|
2021-11-28 15:59:30 +00:00
|
|
|
EIGEN_DEVICE_FUNC inline bool hasNaN() const;
|
|
|
|
|
EIGEN_DEVICE_FUNC inline bool allFinite() const;
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2016-01-31 16:34:10 +01:00
|
|
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
2016-01-31 10:48:49 -08:00
|
|
|
Derived& operator*=(const Scalar& other);
|
2016-01-31 16:34:10 +01:00
|
|
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
2016-01-31 10:48:49 -08:00
|
|
|
Derived& operator/=(const Scalar& other);
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2022-03-16 16:43:40 +00:00
|
|
|
typedef internal::add_const_on_value_type_t<typename internal::eval<Derived>::type> EvalReturnType;
|
2009-12-04 23:17:14 +01:00
|
|
|
/** \returns the matrix or vector obtained by evaluating this expression.
|
|
|
|
|
*
|
|
|
|
|
* Notice that in the case of a plain matrix or vector (not an expression) this function just returns
|
|
|
|
|
* a const reference, in order to avoid a useless copy.
|
2019-04-24 11:01:35 -07:00
|
|
|
*
|
2018-03-11 10:01:44 -04:00
|
|
|
* \warning Be careful with eval() and the auto C++ keyword, as detailed in this \link TopicPitfalls_auto_keyword page \endlink.
|
2009-12-04 23:17:14 +01:00
|
|
|
*/
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2012-02-03 23:18:26 +01:00
|
|
|
EIGEN_STRONG_INLINE EvalReturnType eval() const
|
2010-06-02 09:45:57 +02:00
|
|
|
{
|
|
|
|
|
// Even though MSVC does not honor strong inlining when the return type
|
2010-05-19 18:57:38 +02:00
|
|
|
// is a dynamic matrix, we desperately need strong inlining for fixed
|
|
|
|
|
// size types on MSVC.
|
2010-10-25 10:15:22 -04:00
|
|
|
return typename internal::eval<Derived>::type(derived());
|
2010-03-09 09:04:21 +01:00
|
|
|
}
|
2021-03-08 12:39:11 -05:00
|
|
|
|
2013-11-30 10:42:23 +01:00
|
|
|
/** swaps *this with the expression \a other.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
template<typename OtherDerived>
|
2019-02-15 16:35:35 +01:00
|
|
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
2014-11-06 09:25:26 +01:00
|
|
|
void swap(const DenseBase<OtherDerived>& other)
|
2013-11-30 10:42:23 +01:00
|
|
|
{
|
2014-11-06 09:25:26 +01:00
|
|
|
EIGEN_STATIC_ASSERT(!OtherDerived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY);
|
2014-02-19 14:06:35 +01:00
|
|
|
eigen_assert(rows()==other.rows() && cols()==other.cols());
|
2013-12-02 15:07:45 +01:00
|
|
|
call_assignment(derived(), other.const_cast_derived(), internal::swap_assign_op<Scalar>());
|
2013-11-30 10:42:23 +01:00
|
|
|
}
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2013-11-30 10:42:23 +01:00
|
|
|
/** swaps *this with the matrix or array \a other.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
template<typename OtherDerived>
|
2019-02-15 16:35:35 +01:00
|
|
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
2013-11-30 10:42:23 +01:00
|
|
|
void swap(PlainObjectBase<OtherDerived>& other)
|
|
|
|
|
{
|
2014-02-19 14:06:35 +01:00
|
|
|
eigen_assert(rows()==other.rows() && cols()==other.cols());
|
2013-12-02 15:07:45 +01:00
|
|
|
call_assignment(derived(), other.derived(), internal::swap_assign_op<Scalar>());
|
2013-11-30 10:42:23 +01:00
|
|
|
}
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2013-06-05 15:38:33 +02:00
|
|
|
EIGEN_DEVICE_FUNC inline const NestByValue<Derived> nestByValue() const;
|
|
|
|
|
EIGEN_DEVICE_FUNC inline const ForceAlignedAccess<Derived> forceAlignedAccess() const;
|
|
|
|
|
EIGEN_DEVICE_FUNC inline ForceAlignedAccess<Derived> forceAlignedAccess();
|
|
|
|
|
template<bool Enable> EIGEN_DEVICE_FUNC
|
2022-03-16 16:43:40 +00:00
|
|
|
inline const std::conditional_t<Enable,ForceAlignedAccess<Derived>,Derived&> forceAlignedAccessIf() const;
|
2013-06-05 15:38:33 +02:00
|
|
|
template<bool Enable> EIGEN_DEVICE_FUNC
|
2022-03-16 16:43:40 +00:00
|
|
|
inline std::conditional_t<Enable,ForceAlignedAccess<Derived>,Derived&> forceAlignedAccessIf();
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC Scalar sum() const;
|
|
|
|
|
EIGEN_DEVICE_FUNC Scalar mean() const;
|
|
|
|
|
EIGEN_DEVICE_FUNC Scalar trace() const;
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC Scalar prod() const;
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2021-02-24 17:49:20 -08:00
|
|
|
template<int NaNPropagation>
|
2021-02-24 17:59:36 -08:00
|
|
|
EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar minCoeff() const;
|
2021-02-24 17:49:20 -08:00
|
|
|
template<int NaNPropagation>
|
|
|
|
|
EIGEN_DEVICE_FUNC typename internal::traits<Derived>::Scalar maxCoeff() const;
|
|
|
|
|
|
2021-02-26 09:12:44 -08:00
|
|
|
|
2021-02-26 09:07:00 -08:00
|
|
|
// By default, the fastest version with undefined NaN propagation semantics is
|
|
|
|
|
// used.
|
2021-02-26 09:08:45 -08:00
|
|
|
// TODO(rmlarsen): Replace with default template argument when we move to
|
|
|
|
|
// c++11 or beyond.
|
2021-03-16 17:02:50 +00:00
|
|
|
EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Scalar minCoeff() const {
|
2021-02-26 09:07:00 -08:00
|
|
|
return minCoeff<PropagateFast>();
|
|
|
|
|
}
|
2021-03-16 17:02:50 +00:00
|
|
|
EIGEN_DEVICE_FUNC inline typename internal::traits<Derived>::Scalar maxCoeff() const {
|
2021-02-26 09:07:00 -08:00
|
|
|
return maxCoeff<PropagateFast>();
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-16 17:02:50 +00:00
|
|
|
template<int NaNPropagation, typename IndexType>
|
|
|
|
|
EIGEN_DEVICE_FUNC
|
2011-01-25 21:28:20 -05:00
|
|
|
typename internal::traits<Derived>::Scalar minCoeff(IndexType* row, IndexType* col) const;
|
2021-03-16 17:02:50 +00:00
|
|
|
template<int NaNPropagation, typename IndexType>
|
|
|
|
|
EIGEN_DEVICE_FUNC
|
2011-01-25 21:28:20 -05:00
|
|
|
typename internal::traits<Derived>::Scalar maxCoeff(IndexType* row, IndexType* col) const;
|
2021-03-16 17:02:50 +00:00
|
|
|
template<int NaNPropagation, typename IndexType>
|
|
|
|
|
EIGEN_DEVICE_FUNC
|
2011-01-25 21:28:20 -05:00
|
|
|
typename internal::traits<Derived>::Scalar minCoeff(IndexType* index) const;
|
2021-03-16 17:02:50 +00:00
|
|
|
template<int NaNPropagation, typename IndexType>
|
|
|
|
|
EIGEN_DEVICE_FUNC
|
2011-01-25 21:28:20 -05:00
|
|
|
typename internal::traits<Derived>::Scalar maxCoeff(IndexType* index) const;
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2021-03-16 17:02:50 +00:00
|
|
|
// TODO(rmlarsen): Replace these methods with a default template argument.
|
|
|
|
|
template<typename IndexType>
|
|
|
|
|
EIGEN_DEVICE_FUNC inline
|
|
|
|
|
typename internal::traits<Derived>::Scalar minCoeff(IndexType* row, IndexType* col) const {
|
|
|
|
|
return minCoeff<PropagateFast>(row, col);
|
|
|
|
|
}
|
|
|
|
|
template<typename IndexType>
|
|
|
|
|
EIGEN_DEVICE_FUNC inline
|
|
|
|
|
typename internal::traits<Derived>::Scalar maxCoeff(IndexType* row, IndexType* col) const {
|
|
|
|
|
return maxCoeff<PropagateFast>(row, col);
|
|
|
|
|
}
|
|
|
|
|
template<typename IndexType>
|
|
|
|
|
EIGEN_DEVICE_FUNC inline
|
|
|
|
|
typename internal::traits<Derived>::Scalar minCoeff(IndexType* index) const {
|
|
|
|
|
return minCoeff<PropagateFast>(index);
|
|
|
|
|
}
|
|
|
|
|
template<typename IndexType>
|
|
|
|
|
EIGEN_DEVICE_FUNC inline
|
|
|
|
|
typename internal::traits<Derived>::Scalar maxCoeff(IndexType* index) const {
|
|
|
|
|
return maxCoeff<PropagateFast>(index);
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-04 23:17:14 +01:00
|
|
|
template<typename BinaryOp>
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2015-06-15 22:40:18 +02:00
|
|
|
Scalar redux(const BinaryOp& func) const;
|
2009-12-04 23:17:14 +01:00
|
|
|
|
|
|
|
|
template<typename Visitor>
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2009-12-04 23:17:14 +01:00
|
|
|
void visit(Visitor& func) const;
|
|
|
|
|
|
2017-02-13 09:46:20 +01:00
|
|
|
/** \returns a WithFormat proxy object allowing to print a matrix the with given
|
|
|
|
|
* format \a fmt.
|
|
|
|
|
*
|
|
|
|
|
* See class IOFormat for some examples.
|
|
|
|
|
*
|
|
|
|
|
* \sa class IOFormat, class WithFormat
|
|
|
|
|
*/
|
|
|
|
|
inline const WithFormat<Derived> format(const IOFormat& fmt) const
|
|
|
|
|
{
|
|
|
|
|
return WithFormat<Derived>(derived(), fmt);
|
|
|
|
|
}
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2010-12-09 03:47:35 -05:00
|
|
|
/** \returns the unique coefficient of a 1x1 expression */
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC
|
2010-12-09 03:47:35 -05:00
|
|
|
CoeffReturnType value() const
|
|
|
|
|
{
|
|
|
|
|
EIGEN_STATIC_ASSERT_SIZE_1x1(Derived)
|
|
|
|
|
eigen_assert(this->rows() == 1 && this->cols() == 1);
|
|
|
|
|
return derived().coeff(0,0);
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-28 09:47:38 +01:00
|
|
|
EIGEN_DEVICE_FUNC bool all() const;
|
|
|
|
|
EIGEN_DEVICE_FUNC bool any() const;
|
|
|
|
|
EIGEN_DEVICE_FUNC Index count() const;
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2010-12-22 17:45:37 -05:00
|
|
|
typedef VectorwiseOp<Derived, Horizontal> RowwiseReturnType;
|
|
|
|
|
typedef const VectorwiseOp<const Derived, Horizontal> ConstRowwiseReturnType;
|
|
|
|
|
typedef VectorwiseOp<Derived, Vertical> ColwiseReturnType;
|
|
|
|
|
typedef const VectorwiseOp<const Derived, Vertical> ConstColwiseReturnType;
|
|
|
|
|
|
2018-10-05 23:12:09 +02:00
|
|
|
/** \returns a VectorwiseOp wrapper of *this for broadcasting and partial reductions
|
2015-07-22 12:29:18 +02:00
|
|
|
*
|
|
|
|
|
* Example: \include MatrixBase_rowwise.cpp
|
|
|
|
|
* Output: \verbinclude MatrixBase_rowwise.out
|
|
|
|
|
*
|
|
|
|
|
* \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
|
|
|
|
|
*/
|
|
|
|
|
//Code moved here due to a CUDA compiler bug
|
|
|
|
|
EIGEN_DEVICE_FUNC inline ConstRowwiseReturnType rowwise() const {
|
|
|
|
|
return ConstRowwiseReturnType(derived());
|
|
|
|
|
}
|
2015-07-15 10:57:55 +02:00
|
|
|
EIGEN_DEVICE_FUNC RowwiseReturnType rowwise();
|
2015-07-22 12:29:18 +02:00
|
|
|
|
2018-10-05 23:12:09 +02:00
|
|
|
/** \returns a VectorwiseOp wrapper of *this broadcasting and partial reductions
|
2015-07-22 12:29:18 +02:00
|
|
|
*
|
|
|
|
|
* Example: \include MatrixBase_colwise.cpp
|
|
|
|
|
* Output: \verbinclude MatrixBase_colwise.out
|
|
|
|
|
*
|
|
|
|
|
* \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting
|
|
|
|
|
*/
|
|
|
|
|
EIGEN_DEVICE_FUNC inline ConstColwiseReturnType colwise() const {
|
|
|
|
|
return ConstColwiseReturnType(derived());
|
|
|
|
|
}
|
2015-07-15 10:57:55 +02:00
|
|
|
EIGEN_DEVICE_FUNC ColwiseReturnType colwise();
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2015-06-22 10:52:08 +02:00
|
|
|
typedef CwiseNullaryOp<internal::scalar_random_op<Scalar>,PlainObject> RandomReturnType;
|
|
|
|
|
static const RandomReturnType Random(Index rows, Index cols);
|
|
|
|
|
static const RandomReturnType Random(Index size);
|
|
|
|
|
static const RandomReturnType Random();
|
2009-12-04 23:17:14 +01:00
|
|
|
|
|
|
|
|
template<typename ThenDerived,typename ElseDerived>
|
2020-08-20 16:48:11 +02:00
|
|
|
inline EIGEN_DEVICE_FUNC const Select<Derived,ThenDerived,ElseDerived>
|
2009-12-04 23:17:14 +01:00
|
|
|
select(const DenseBase<ThenDerived>& thenMatrix,
|
|
|
|
|
const DenseBase<ElseDerived>& elseMatrix) const;
|
|
|
|
|
|
|
|
|
|
template<typename ThenDerived>
|
2020-08-20 16:48:11 +02:00
|
|
|
inline EIGEN_DEVICE_FUNC const Select<Derived,ThenDerived, typename ThenDerived::ConstantReturnType>
|
2013-04-12 15:26:55 +02:00
|
|
|
select(const DenseBase<ThenDerived>& thenMatrix, const typename ThenDerived::Scalar& elseScalar) const;
|
2009-12-04 23:17:14 +01:00
|
|
|
|
|
|
|
|
template<typename ElseDerived>
|
2020-08-20 16:48:11 +02:00
|
|
|
inline EIGEN_DEVICE_FUNC const Select<Derived, typename ElseDerived::ConstantReturnType, ElseDerived >
|
2013-04-12 15:26:55 +02:00
|
|
|
select(const typename ElseDerived::Scalar& thenScalar, const DenseBase<ElseDerived>& elseMatrix) const;
|
2009-12-04 23:17:14 +01:00
|
|
|
|
|
|
|
|
template<int p> RealScalar lpNorm() const;
|
|
|
|
|
|
|
|
|
|
template<int RowFactor, int ColFactor>
|
2015-07-20 10:53:03 +02:00
|
|
|
EIGEN_DEVICE_FUNC
|
2009-12-04 23:17:14 +01:00
|
|
|
const Replicate<Derived,RowFactor,ColFactor> replicate() const;
|
2015-07-22 12:29:18 +02:00
|
|
|
/**
|
|
|
|
|
* \return an expression of the replication of \c *this
|
|
|
|
|
*
|
|
|
|
|
* Example: \include MatrixBase_replicate_int_int.cpp
|
|
|
|
|
* Output: \verbinclude MatrixBase_replicate_int_int.out
|
|
|
|
|
*
|
|
|
|
|
* \sa VectorwiseOp::replicate(), DenseBase::replicate<int,int>(), class Replicate
|
|
|
|
|
*/
|
|
|
|
|
//Code moved here due to a CUDA compiler bug
|
2015-07-20 10:53:03 +02:00
|
|
|
EIGEN_DEVICE_FUNC
|
2015-07-22 12:29:18 +02:00
|
|
|
const Replicate<Derived, Dynamic, Dynamic> replicate(Index rowFactor, Index colFactor) const
|
|
|
|
|
{
|
|
|
|
|
return Replicate<Derived, Dynamic, Dynamic>(derived(), rowFactor, colFactor);
|
|
|
|
|
}
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2010-12-22 17:45:37 -05:00
|
|
|
typedef Reverse<Derived, BothDirections> ReverseReturnType;
|
|
|
|
|
typedef const Reverse<const Derived, BothDirections> ConstReverseReturnType;
|
2015-07-22 12:29:18 +02:00
|
|
|
EIGEN_DEVICE_FUNC ReverseReturnType reverse();
|
|
|
|
|
/** This is the const version of reverse(). */
|
|
|
|
|
//Code moved here due to a CUDA compiler bug
|
|
|
|
|
EIGEN_DEVICE_FUNC ConstReverseReturnType reverse() const
|
|
|
|
|
{
|
|
|
|
|
return ConstReverseReturnType(derived());
|
|
|
|
|
}
|
|
|
|
|
EIGEN_DEVICE_FUNC void reverseInPlace();
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2018-10-03 15:13:15 +02:00
|
|
|
#ifdef EIGEN_PARSED_BY_DOXYGEN
|
2018-10-09 19:33:35 +02:00
|
|
|
/** STL-like <a href="https://en.cppreference.com/w/cpp/named_req/RandomAccessIterator">RandomAccessIterator</a>
|
2018-10-03 15:13:15 +02:00
|
|
|
* iterator type as returned by the begin() and end() methods.
|
|
|
|
|
*/
|
|
|
|
|
typedef random_access_iterator_type iterator;
|
|
|
|
|
/** This is the const version of iterator (aka read-only) */
|
|
|
|
|
typedef random_access_iterator_type const_iterator;
|
|
|
|
|
#else
|
2022-03-16 16:43:40 +00:00
|
|
|
typedef std::conditional_t< (Flags&DirectAccessBit)==DirectAccessBit,
|
|
|
|
|
internal::pointer_based_stl_iterator<Derived>,
|
|
|
|
|
internal::generic_randaccess_stl_iterator<Derived>
|
|
|
|
|
> iterator_type;
|
2018-10-02 23:44:36 +02:00
|
|
|
|
2022-03-16 16:43:40 +00:00
|
|
|
typedef std::conditional_t< (Flags&DirectAccessBit)==DirectAccessBit,
|
|
|
|
|
internal::pointer_based_stl_iterator<const Derived>,
|
|
|
|
|
internal::generic_randaccess_stl_iterator<const Derived>
|
|
|
|
|
> const_iterator_type;
|
2018-10-09 15:28:23 -07:00
|
|
|
|
|
|
|
|
// Stl-style iterators are supported only for vectors.
|
|
|
|
|
|
2022-03-16 16:43:40 +00:00
|
|
|
typedef std::conditional_t<IsVectorAtCompileTime, iterator_type, void> iterator;
|
2018-10-09 15:28:23 -07:00
|
|
|
|
2022-03-16 16:43:40 +00:00
|
|
|
typedef std::conditional_t<IsVectorAtCompileTime, const_iterator_type, void> const_iterator;
|
2018-10-03 15:13:15 +02:00
|
|
|
#endif
|
|
|
|
|
|
2018-10-02 23:44:36 +02:00
|
|
|
inline iterator begin();
|
|
|
|
|
inline const_iterator begin() const;
|
|
|
|
|
inline const_iterator cbegin() const;
|
|
|
|
|
inline iterator end();
|
|
|
|
|
inline const_iterator end() const;
|
|
|
|
|
inline const_iterator cend() const;
|
2018-10-01 23:21:37 +02:00
|
|
|
|
2010-08-25 13:09:56 +02:00
|
|
|
#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase
|
2016-09-16 11:23:19 +02:00
|
|
|
#define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
|
|
|
|
|
#define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND)
|
2017-01-02 22:27:07 +01:00
|
|
|
#define EIGEN_DOC_UNARY_ADDONS(X,Y)
|
|
|
|
|
# include "../plugins/CommonCwiseUnaryOps.h"
|
2010-08-25 13:09:56 +02:00
|
|
|
# include "../plugins/BlockMethods.h"
|
2017-01-10 21:45:55 +01:00
|
|
|
# include "../plugins/IndexedViewMethods.h"
|
2017-01-29 15:20:35 +01:00
|
|
|
# include "../plugins/ReshapedMethods.h"
|
2010-08-25 13:09:56 +02:00
|
|
|
# ifdef EIGEN_DENSEBASE_PLUGIN
|
|
|
|
|
# include EIGEN_DENSEBASE_PLUGIN
|
|
|
|
|
# endif
|
|
|
|
|
#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
|
2016-09-16 11:23:19 +02:00
|
|
|
#undef EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
|
|
|
|
|
#undef EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF
|
2017-01-02 22:27:07 +01:00
|
|
|
#undef EIGEN_DOC_UNARY_ADDONS
|
2009-12-04 23:17:14 +01:00
|
|
|
|
2010-02-15 11:09:33 +01:00
|
|
|
// disable the use of evalTo for dense objects with a nice compilation error
|
2013-02-07 19:06:14 +01:00
|
|
|
template<typename Dest>
|
|
|
|
|
EIGEN_DEVICE_FUNC
|
|
|
|
|
inline void evalTo(Dest& ) const
|
2010-02-15 11:09:33 +01:00
|
|
|
{
|
2010-10-25 22:13:49 +02:00
|
|
|
EIGEN_STATIC_ASSERT((internal::is_same<Dest,void>::value),THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS);
|
2010-02-15 11:09:33 +01:00
|
|
|
}
|
|
|
|
|
|
2009-12-04 23:17:14 +01:00
|
|
|
protected:
|
2019-12-19 17:30:11 +01:00
|
|
|
EIGEN_DEFAULT_COPY_CONSTRUCTOR(DenseBase)
|
2009-12-04 23:17:14 +01:00
|
|
|
/** Default constructor. Do nothing. */
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC DenseBase()
|
2009-12-04 23:17:14 +01:00
|
|
|
{
|
|
|
|
|
/* Just checks for self-consistency of the flags.
|
2019-12-19 17:30:11 +01:00
|
|
|
* Only do it when debugging Eigen, as this borders on paranoia and could slow compilation down
|
2009-12-04 23:17:14 +01:00
|
|
|
*/
|
|
|
|
|
#ifdef EIGEN_INTERNAL_DEBUGGING
|
2021-12-10 19:27:01 +00:00
|
|
|
EIGEN_STATIC_ASSERT((internal::check_implication(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, int(IsRowMajor))
|
|
|
|
|
&& internal::check_implication(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, int(!IsRowMajor))),
|
2010-03-21 11:28:03 -04:00
|
|
|
INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION)
|
2009-12-04 23:17:14 +01:00
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
2013-02-07 19:06:14 +01:00
|
|
|
EIGEN_DEVICE_FUNC explicit DenseBase(int);
|
|
|
|
|
EIGEN_DEVICE_FUNC DenseBase(int,int);
|
|
|
|
|
template<typename OtherDerived> EIGEN_DEVICE_FUNC explicit DenseBase(const DenseBase<OtherDerived>&);
|
2009-12-04 23:17:14 +01:00
|
|
|
};
|
|
|
|
|
|
2012-04-15 11:06:28 +01:00
|
|
|
} // end namespace Eigen
|
|
|
|
|
|
2009-12-04 23:17:14 +01:00
|
|
|
#endif // EIGEN_DENSEBASE_H
|