10 #ifndef EIGEN_CWISE_NULLARY_OP_H 11 #define EIGEN_CWISE_NULLARY_OP_H 34 template<
typename NullaryOp,
typename PlainObjectType>
48 template<
typename NullaryOp,
typename PlainObjectType>
57 CwiseNullaryOp(Index nbRows, Index nbCols, const NullaryOp& func = NullaryOp())
58 : m_rows(nbRows), m_cols(nbCols), m_functor(func)
61 && (RowsAtCompileTime ==
Dynamic || RowsAtCompileTime == nbRows)
63 && (ColsAtCompileTime ==
Dynamic || ColsAtCompileTime == nbCols));
71 return m_functor(rowId, colId);
74 template<
int LoadMode>
77 return m_functor.packetOp(rowId, colId);
82 return m_functor(index);
85 template<
int LoadMode>
88 return m_functor.packetOp(index);
92 const NullaryOp&
functor()
const {
return m_functor; }
114 template<
typename Derived>
115 template<
typename CustomNullaryOp>
137 template<
typename Derived>
138 template<
typename CustomNullaryOp>
156 template<
typename Derived>
157 template<
typename CustomNullaryOp>
177 template<
typename Derived>
199 template<
typename Derived>
215 template<
typename Derived>
240 template<
typename Derived>
252 template<
typename Derived>
274 template<
typename Derived>
286 template<
typename Derived>
296 template<
typename Derived>
300 for(
Index j = 0; j < cols(); ++j)
301 for(
Index i = 0; i < rows(); ++i)
310 template<
typename Derived>
314 return isApproxToConstant(val, prec);
321 template<
typename Derived>
331 template<
typename Derived>
334 return derived() = Constant(rows(), cols(), val);
346 template<
typename Derived>
351 return setConstant(val);
365 template<
typename Derived>
369 resize(nbRows, nbCols);
370 return setConstant(val);
386 template<
typename Derived>
403 template<
typename Derived>
407 return setLinSpaced(size(), low, high);
426 template<
typename Derived>
430 return Constant(nbRows, nbCols,
Scalar(0));
449 template<
typename Derived>
453 return Constant(size,
Scalar(0));
466 template<
typename Derived>
470 return Constant(
Scalar(0));
481 template<
typename Derived>
484 for(
Index j = 0; j < cols(); ++j)
485 for(
Index i = 0; i < rows(); ++i)
498 template<
typename Derived>
501 return setConstant(
Scalar(0));
513 template<
typename Derived>
518 return setConstant(
Scalar(0));
531 template<
typename Derived>
535 resize(nbRows, nbCols);
536 return setConstant(
Scalar(0));
555 template<
typename Derived>
559 return Constant(nbRows, nbCols,
Scalar(1));
578 template<
typename Derived>
582 return Constant(newSize,
Scalar(1));
595 template<
typename Derived>
599 return Constant(
Scalar(1));
610 template<
typename Derived>
614 return isApproxToConstant(
Scalar(1), prec);
624 template<
typename Derived>
627 return setConstant(
Scalar(1));
639 template<
typename Derived>
644 return setConstant(
Scalar(1));
657 template<
typename Derived>
661 resize(nbRows, nbCols);
662 return setConstant(
Scalar(1));
681 template<
typename Derived>
698 template<
typename Derived>
715 template<
typename Derived>
719 for(
Index j = 0; j < cols(); ++j)
721 for(
Index i = 0; i < rows(); ++i)
740 template<
typename Derived,
bool Big = (Derived::SizeAtCompileTime>=16)>
745 return m = Derived::Identity(m.rows(), m.cols());
749 template<
typename Derived>
752 typedef typename Derived::Index
Index;
756 const Index size = (std::min)(m.rows(), m.cols());
757 for(Index i = 0; i < size; ++i) m.coeffRef(i,i) =
typename Derived::Scalar(1);
771 template<
typename Derived>
787 template<
typename Derived>
790 derived().resize(nbRows, nbCols);
800 template<
typename Derived>
804 return BasisReturnType(SquareMatrixType::Identity(newSize,newSize), i);
815 template<
typename Derived>
828 template<
typename Derived>
830 {
return Derived::Unit(0); }
838 template<
typename Derived>
840 {
return Derived::Unit(1); }
848 template<
typename Derived>
850 {
return Derived::Unit(2); }
858 template<
typename Derived>
860 {
return Derived::Unit(3); }
864 #endif // EIGEN_CWISE_NULLARY_OP_H Generic expression of a matrix where all coefficients are defined by a functor.
static EIGEN_STRONG_INLINE Derived & run(Derived &m)
void fill(const Scalar &value)
internal::traits< Derived >::Scalar Scalar
void setIdentity(geometry_msgs::Transform &tx)
const internal::variable_if_dynamic< Index, ColsAtCompileTime > m_cols
static const CwiseNullaryOp< CustomNullaryOp, Derived > NullaryExpr(Index rows, Index cols, const CustomNullaryOp &func)
#define EIGEN_STRONG_INLINE
internal::traits< Derived >::Scalar Scalar
static const BasisReturnType UnitW()
Derived & setConstant(const Scalar &value)
internal::traits< Derived >::Index Index
The type of indices.
static const SequentialLinSpacedReturnType LinSpaced(Sequential_t, Index size, const Scalar &low, const Scalar &high)
Sets a linearly space vector.
EIGEN_STRONG_INLINE const Scalar coeff(Index index) const
internal::traits< Derived >::Index Index
bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, typename NumTraits< Scalar >::Real precision=NumTraits< Scalar >::dummy_precision())
const internal::variable_if_dynamic< Index, RowsAtCompileTime > m_rows
static const BasisReturnType UnitY()
const unsigned int PacketAccessBit
const NullaryOp m_functor
EIGEN_STRONG_INLINE const Scalar coeff(Index rowId, Index colId) const
const unsigned int HereditaryBits
bool isZero(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
static EIGEN_STRONG_INLINE Derived & run(Derived &m)
static const ConstantReturnType Zero()
EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const
Derived & setLinSpaced(Index size, const Scalar &low, const Scalar &high)
Sets a linearly space vector.
EIGEN_STRONG_INLINE PacketScalar packet(Index index) const
bool isApprox(const Scalar &x, const Scalar &y, typename NumTraits< Scalar >::Real precision=NumTraits< Scalar >::dummy_precision())
EIGEN_STRONG_INLINE Index cols() const
#define EIGEN_STATIC_ASSERT_FIXED_SIZE(TYPE)
bool isOnes(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
static const BasisReturnType UnitZ()
Derived & setZero(Index size)
bool isIdentity(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Derived & setConstant(Index size, const Scalar &value)
static const IdentityReturnType Identity()
const NullaryOp & functor() const
Derived & setOnes(Index size)
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
NumTraits< Scalar >::Real RealScalar
bool isConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Expression of a fixed-size or dynamic-size block.
static const ConstantReturnType Ones()
bool isApproxToConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
const unsigned int EvalBeforeNestingBit
static const BasisReturnType UnitX()
static const ConstantReturnType Constant(Index rows, Index cols, const Scalar &value)
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
static const BasisReturnType Unit(Index size, Index i)
const unsigned int LinearAccessBit
EIGEN_STRONG_INLINE Index rows() const
internal::dense_xpr_base< CwiseNullaryOp >::type Base