10 #ifndef EIGEN_CWISE_NULLARY_OP_H
11 #define EIGEN_CWISE_NULLARY_OP_H
18 template<
typename NullaryOp,
typename PlainObjectType>
19 struct traits<CwiseNullaryOp<NullaryOp, PlainObjectType> > : traits<PlainObjectType>
22 Flags = traits<PlainObjectType>::Flags &
RowMajorBit
61 template<
typename NullaryOp,
typename PlainObjectType>
62 class CwiseNullaryOp :
public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp, PlainObjectType> >::type, internal::no_assignment_operator
66 typedef typename internal::dense_xpr_base<CwiseNullaryOp>::type
Base;
74 && (RowsAtCompileTime ==
Dynamic || RowsAtCompileTime ==
rows)
76 && (ColsAtCompileTime ==
Dynamic || ColsAtCompileTime ==
cols));
89 const internal::variable_if_dynamic<Index, RowsAtCompileTime>
m_rows;
90 const internal::variable_if_dynamic<Index, ColsAtCompileTime>
m_cols;
108 template<
typename Derived>
109 template<
typename CustomNullaryOp>
111 #ifndef EIGEN_PARSED_BY_DOXYGEN
139 template<
typename Derived>
140 template<
typename CustomNullaryOp>
142 #ifndef EIGEN_PARSED_BY_DOXYGEN
163 template<
typename Derived>
164 template<
typename CustomNullaryOp>
166 #ifndef EIGEN_PARSED_BY_DOXYGEN
189 template<
typename Derived>
211 template<
typename Derived>
227 template<
typename Derived>
244 template<
typename Derived>
256 template<
typename Derived>
262 return
DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime,
internal::linspaced_op<
Scalar>(low,high,Derived::SizeAtCompileTime));
288 template<typename Derived>
300 template<
typename Derived>
309 template <
typename Derived>
316 template <
typename Derived>
324 template<
typename Derived>
328 typename internal::nested_eval<Derived,1>::type
self(derived());
339 template<
typename Derived>
343 return isApproxToConstant(val, prec);
350 template<
typename Derived>
360 template<
typename Derived>
375 template<
typename Derived>
394 template<
typename Derived>
408 template<
typename Derived>
421 template<
typename Derived>
445 template<
typename Derived>
449 return derived() = Derived::NullaryExpr(newSize, internal::linspaced_op<Scalar>(low,high,newSize));
465 template<
typename Derived>
472 template <
typename Derived>
476 return derived() = Derived::NullaryExpr(newSize, internal::equalspaced_op<Scalar>(low, step));
478 template <
typename Derived>
482 return setEqualSpaced(
size(), low, step);
501 template<
typename Derived>
524 template<
typename Derived>
541 template<
typename Derived>
545 return Constant(
Scalar(0));
556 template<
typename Derived>
559 typename internal::nested_eval<Derived,1>::type
self(derived());
574 template<
typename Derived>
589 template<
typename Derived>
607 template<
typename Derived>
621 template<
typename Derived>
634 template<
typename Derived>
657 template<
typename Derived>
680 template<
typename Derived>
684 return Constant(newSize,
Scalar(1));
697 template<
typename Derived>
701 return Constant(
Scalar(1));
712 template<
typename Derived>
716 return isApproxToConstant(
Scalar(1), prec);
726 template<
typename Derived>
741 template<
typename Derived>
759 template<
typename Derived>
773 template<
typename Derived>
786 template<
typename Derived>
809 template<
typename Derived>
826 template<
typename Derived>
843 template<
typename Derived>
847 typename internal::nested_eval<Derived,1>::type
self(derived());
869 template<
typename Derived,
bool Big = (Derived::SizeAtCompileTime>=16)>
870 struct setIdentity_impl
873 static EIGEN_STRONG_INLINE Derived& run(Derived&
m)
875 return m = Derived::Identity(
m.rows(),
m.cols());
879 template<
typename Derived>
880 struct setIdentity_impl<Derived, true>
883 static EIGEN_STRONG_INLINE Derived& run(Derived&
m)
887 for(
Index i = 0;
i <
size; ++
i)
m.coeffRef(
i,
i) =
typename Derived::Scalar(1);
901 template<
typename Derived>
904 return internal::setIdentity_impl<Derived>::run(derived());
917 template<
typename Derived>
930 template<
typename Derived>
934 return BasisReturnType(SquareMatrixType::Identity(newSize,newSize),
i);
945 template<
typename Derived>
949 return BasisReturnType(SquareMatrixType::Identity(),
i);
958 template<
typename Derived>
960 {
return Derived::Unit(0); }
968 template<
typename Derived>
970 {
return Derived::Unit(1); }
978 template<
typename Derived>
980 {
return Derived::Unit(2); }
988 template<
typename Derived>
990 {
return Derived::Unit(3); }
1000 template<
typename Derived>
1005 derived().setZero();
1006 derived().coeffRef(
i) =
Scalar(1);
1019 template<
typename Derived>
1024 derived().resize(newSize);
v setLinSpaced(5, 0.5f, 1.5f)
#define EIGEN_DEVICE_FUNC
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
#define EIGEN_STATIC_ASSERT_FIXED_SIZE(TYPE)
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
Generic expression of a matrix where all coefficients are defined by a functor.
const internal::variable_if_dynamic< Index, ColsAtCompileTime > m_cols
EIGEN_CONSTEXPR Index rows() const
const internal::variable_if_dynamic< Index, RowsAtCompileTime > m_rows
CwiseNullaryOp(Index rows, Index cols, const NullaryOp &func=NullaryOp())
const NullaryOp m_functor
internal::dense_xpr_base< CwiseNullaryOp >::type Base
EIGEN_CONSTEXPR Index cols() const
const NullaryOp & functor() const
Base class for all dense matrices, vectors, and arrays.
static EIGEN_DEPRECATED const RandomAccessLinSpacedReturnType LinSpaced(Sequential_t, Index size, const Scalar &low, const Scalar &high)
bool isConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
NumTraits< Scalar >::Real RealScalar
static const ConstantReturnType Ones()
static const CwiseNullaryOp< CustomNullaryOp, PlainObject > NullaryExpr(Index rows, Index cols, const CustomNullaryOp &func)
static const ConstantReturnType Zero()
Derived & setLinSpaced(Index size, const Scalar &low, const Scalar &high)
Sets a linearly spaced vector.
internal::traits< Derived >::Scalar Scalar
static const ConstantReturnType Constant(Index rows, Index cols, const Scalar &value)
void fill(const Scalar &value)
Derived & setEqualSpaced(Index size, const Scalar &low, const Scalar &step)
bool isOnes(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
static const RandomAccessEqualSpacedReturnType EqualSpaced(Index size, const Scalar &low, const Scalar &step)
Derived & setConstant(const Scalar &value)
bool isZero(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
bool isApproxToConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Base class for all dense matrices, vectors, and expressions.
static const BasisReturnType UnitY()
bool isIdentity(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
static const BasisReturnType UnitX()
static const IdentityReturnType Identity()
static const BasisReturnType UnitZ()
static const BasisReturnType Unit(Index size, Index i)
Derived & setUnit(Index i)
Set the coefficients of *this to the i-th unit (basis) vector.
static const BasisReturnType UnitW()
NumTraits< Scalar >::Real RealScalar
internal::traits< Derived >::Scalar Scalar
Derived & setOnes(Index size)
Derived & setConstant(Index size, const Scalar &val)
Derived & setZero(Index size)
const unsigned int RowMajorBit
bool isApprox(const Scalar &x, const Scalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())
EIGEN_ALWAYS_INLINE T mini(const T &x, const T &y)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Eigen::Index Index
The interface type of indices.