10#ifndef EIGEN_CWISE_NULLARY_OP_H
11#define EIGEN_CWISE_NULLARY_OP_H
16template<
typename NullaryOp,
typename PlainObjectType>
59template<
typename NullaryOp,
typename PlainObjectType>
69 : m_rows(rows), m_cols(cols), m_functor(func)
71 eigen_assert(rows >= 0
72 && (RowsAtCompileTime ==
Dynamic || RowsAtCompileTime == rows)
74 && (ColsAtCompileTime ==
Dynamic || ColsAtCompileTime == cols));
77 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
79 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
106template<
typename Derived>
107template<
typename CustomNullaryOp>
108EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
109#ifndef EIGEN_PARSED_BY_DOXYGEN
110const CwiseNullaryOp<CustomNullaryOp,typename DenseBase<Derived>::PlainObject>
112const CwiseNullaryOp<CustomNullaryOp,PlainObject>
137template<
typename Derived>
138template<
typename CustomNullaryOp>
139EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
140#ifndef EIGEN_PARSED_BY_DOXYGEN
147 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
161template<
typename Derived>
162template<
typename CustomNullaryOp>
163EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
164#ifndef EIGEN_PARSED_BY_DOXYGEN
187template<
typename Derived>
209template<
typename Derived>
225template<
typename Derived>
229 EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
242template<
typename Derived>
246 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
254template<
typename Derived>
258 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
259 EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
286template<
typename Derived>
290 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
298template<
typename Derived>
302 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
303 EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
308template<
typename Derived>
310(
const Scalar& val,
const RealScalar&
prec)
const
313 for(
Index j = 0; j < cols(); ++j)
314 for(
Index i = 0; i < rows(); ++i)
315 if(!internal::isApprox(self.coeff(i, j), val,
prec))
323template<
typename Derived>
325(
const Scalar& val,
const RealScalar&
prec)
const
334template<
typename Derived>
344template<
typename Derived>
347 return derived() =
Constant(rows(), cols(), val);
359template<
typename Derived>
360EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
378template<
typename Derived>
379EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
392template<
typename Derived>
393EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
405template<
typename Derived>
406EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
429template<
typename Derived>
432 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
449template<
typename Derived>
452 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
472template<
typename Derived>
495template<
typename Derived>
512template<
typename Derived>
527template<
typename Derived>
531 for(
Index j = 0; j < cols(); ++j)
532 for(
Index i = 0; i < rows(); ++i)
533 if(!internal::isMuchSmallerThan(self.coeff(i, j),
static_cast<Scalar>(1),
prec))
545template<
typename Derived>
560template<
typename Derived>
561EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
578template<
typename Derived>
579EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
592template<
typename Derived>
593EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
605template<
typename Derived>
606EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
628template<
typename Derived>
651template<
typename Derived>
668template<
typename Derived>
683template<
typename Derived>
685(
const RealScalar&
prec)
const
697template<
typename Derived>
712template<
typename Derived>
713EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
730template<
typename Derived>
731EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
744template<
typename Derived>
745EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
757template<
typename Derived>
758EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
780template<
typename Derived>
797template<
typename Derived>
801 EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
814template<
typename Derived>
816(
const RealScalar&
prec)
const
819 for(
Index j = 0; j < cols(); ++j)
821 for(
Index i = 0; i < rows(); ++i)
825 if(!internal::isApprox(self.coeff(i, j),
static_cast<Scalar
>(1),
prec))
830 if(!internal::isMuchSmallerThan(self.coeff(i, j),
static_cast<RealScalar
>(1),
prec))
840template<
typename Derived,
bool Big = (Derived::SizeAtCompileTime>=16)>
844 static EIGEN_STRONG_INLINE Derived& run(Derived& m)
846 return m = Derived::Identity(m.rows(), m.cols());
850template<
typename Derived>
854 static EIGEN_STRONG_INLINE Derived& run(Derived& m)
857 const Index size = numext::mini(m.rows(), m.cols());
858 for(
Index i = 0; i < size; ++i) m.coeffRef(i,i) =
typename Derived::Scalar(1);
872template<
typename Derived>
888template<
typename Derived>
891 derived().
resize(rows, cols);
901template<
typename Derived>
904 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
916template<
typename Derived>
919 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
929template<
typename Derived>
931{
return Derived::Unit(0); }
939template<
typename Derived>
941{
return Derived::Unit(1); }
949template<
typename Derived>
951{
return Derived::Unit(2); }
959template<
typename Derived>
961{
return Derived::Unit(3); }
971template<
typename Derived>
974 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
975 eigen_assert(i<size());
977 derived().coeffRef(i) = Scalar(1);
990template<
typename Derived>
993 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
Generic expression of a matrix where all coefficients are defined by a functor.
Definition CwiseNullaryOp.h:61
EIGEN_DEVICE_FUNC const NullaryOp & functor() const
Definition CwiseNullaryOp.h:84
Base class for all dense matrices, vectors, and arrays.
Definition DenseBase.h:47
static EIGEN_DEVICE_FUNC const ConstantReturnType Constant(Index rows, Index cols, const Scalar &value)
Definition CwiseNullaryOp.h:189
EIGEN_DEVICE_FUNC void resize(Index newSize)
Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods...
Definition DenseBase.h:246
EIGEN_DEVICE_FUNC Derived & setLinSpaced(Index size, const Scalar &low, const Scalar &high)
Sets a linearly spaced vector.
Definition CwiseNullaryOp.h:430
EIGEN_DEVICE_FUNC Derived & setConstant(const Scalar &value)
Sets all coefficients in this expression to value val.
Definition CwiseNullaryOp.h:345
internal::traits< Derived >::Scalar Scalar
The numeric type of the expression' coefficients, e.g.
Definition DenseBase.h:66
EIGEN_DEVICE_FUNC CoeffReturnType value() const
Definition DenseBase.h:526
EIGEN_DEVICE_FUNC bool isApproxToConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:310
EIGEN_DEVICE_FUNC Derived & setZero()
Sets all coefficients in this expression to zero.
Definition CwiseNullaryOp.h:546
EIGEN_DEVICE_FUNC Derived & setOnes()
Sets all coefficients in this expression to one.
Definition CwiseNullaryOp.h:698
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
static EIGEN_DEVICE_FUNC const IdentityReturnType Identity()
Definition CwiseNullaryOp.h:799
@ ColsAtCompileTime
The number of columns at compile-time.
Definition DenseBase.h:106
@ RowsAtCompileTime
The number of rows at compile-time.
Definition DenseBase.h:100
EIGEN_DEVICE_FUNC Derived & setIdentity()
Writes the identity expression (not necessarily square) into *this.
Definition CwiseNullaryOp.h:873
EIGEN_DEVICE_FUNC Derived & setUnit(Index i)
Set the coefficients of *this to the i-th unit (basis) vector.
Definition CwiseNullaryOp.h:972
Definition PlainObjectBase.h:100
Definition XprHelper.h:110
Definition XprHelper.h:130
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:66
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time,...
Definition Constants.h:22
Definition XprHelper.h:484
Definition NullaryFunctors.h:131
Definition NullaryFunctors.h:18
Definition NullaryFunctors.h:31
Definition CwiseNullaryOp.h:842
Definition ForwardDeclarations.h:17