$darkmode
Eigen  5.0.1-dev
CwiseNullaryOp.h
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_CWISE_NULLARY_OP_H
11 #define EIGEN_CWISE_NULLARY_OP_H
12 
13 // IWYU pragma: private
14 #include "./InternalHeaderCheck.h"
15 
16 namespace Eigen {
17 
18 namespace internal {
19 template <typename NullaryOp, typename PlainObjectType>
20 struct traits<CwiseNullaryOp<NullaryOp, PlainObjectType> > : traits<PlainObjectType> {
21  enum { Flags = traits<PlainObjectType>::Flags & RowMajorBit };
22 };
23 
24 } // namespace internal
25 
62 template <typename NullaryOp, typename PlainObjectType>
63 class CwiseNullaryOp : public internal::dense_xpr_base<CwiseNullaryOp<NullaryOp, PlainObjectType> >::type,
64  internal::no_assignment_operator {
65  public:
66  typedef typename internal::dense_xpr_base<CwiseNullaryOp>::type Base;
67  EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp)
68 
69  EIGEN_DEVICE_FUNC CwiseNullaryOp(Index rows, Index cols, const NullaryOp& func = NullaryOp())
70  : m_rows(rows), m_cols(cols), m_functor(func) {
71  eigen_assert(rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) && cols >= 0 &&
72  (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols));
73  }
74  EIGEN_DEVICE_FUNC CwiseNullaryOp(Index size, const NullaryOp& func = NullaryOp())
75  : CwiseNullaryOp(RowsAtCompileTime == 1 ? 1 : size, RowsAtCompileTime == 1 ? size : 1, func) {
76  EIGEN_STATIC_ASSERT(CwiseNullaryOp::IsVectorAtCompileTime, YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX);
77  }
78 
79  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index rows() const { return m_rows.value(); }
80  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr Index cols() const { return m_cols.value(); }
81 
83  EIGEN_DEVICE_FUNC const NullaryOp& functor() const { return m_functor; }
84 
85  protected:
86  const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_rows;
87  const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_cols;
88  const NullaryOp m_functor;
89 };
90 
104 template <typename Derived>
105 template <typename CustomNullaryOp>
106 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
107 #ifndef EIGEN_PARSED_BY_DOXYGEN
108  const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
109 #else
110  const CwiseNullaryOp<CustomNullaryOp, PlainObject>
111 #endif
112  DenseBase<Derived>::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func) {
113  return CwiseNullaryOp<CustomNullaryOp, PlainObject>(rows, cols, func);
114 }
115 
134 template <typename Derived>
135 template <typename CustomNullaryOp>
136 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
137 #ifndef EIGEN_PARSED_BY_DOXYGEN
139 #else
141 #endif
142  DenseBase<Derived>::NullaryExpr(Index size, const CustomNullaryOp& func) {
143  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
144  if (RowsAtCompileTime == 1)
145  return CwiseNullaryOp<CustomNullaryOp, PlainObject>(1, size, func);
146  else
147  return CwiseNullaryOp<CustomNullaryOp, PlainObject>(size, 1, func);
148 }
149 
159 template <typename Derived>
160 template <typename CustomNullaryOp>
161 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
162 #ifndef EIGEN_PARSED_BY_DOXYGEN
164 #else
166 #endif
167  DenseBase<Derived>::NullaryExpr(const CustomNullaryOp& func) {
168  return CwiseNullaryOp<CustomNullaryOp, PlainObject>(RowsAtCompileTime, ColsAtCompileTime, func);
169 }
170 
184 template <typename Derived>
185 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
186 DenseBase<Derived>::Constant(Index rows, Index cols, const Scalar& value) {
187  return DenseBase<Derived>::NullaryExpr(rows, cols, internal::scalar_constant_op<Scalar>(value));
188 }
189 
205 template <typename Derived>
206 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
208  return DenseBase<Derived>::NullaryExpr(size, internal::scalar_constant_op<Scalar>(value));
209 }
210 
220 template <typename Derived>
221 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
223  EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
224  return DenseBase<Derived>::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime,
225  internal::scalar_constant_op<Scalar>(value));
226 }
227 
237 template <typename Derived>
238 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
239 DenseBase<Derived>::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high) {
240  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
241  return DenseBase<Derived>::NullaryExpr(size, internal::linspaced_op<Scalar>(low, high, size));
242 }
243 
248 template <typename Derived>
249 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
250 DenseBase<Derived>::LinSpaced(Sequential_t, const Scalar& low, const Scalar& high) {
251  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
252  EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
253  return DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime,
254  internal::linspaced_op<Scalar>(low, high, Derived::SizeAtCompileTime));
255 }
256 
280 template <typename Derived>
281 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
282 DenseBase<Derived>::LinSpaced(Index size, const Scalar& low, const Scalar& high) {
283  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
284  return DenseBase<Derived>::NullaryExpr(size, internal::linspaced_op<Scalar>(low, high, size));
285 }
286 
291 template <typename Derived>
292 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
293 DenseBase<Derived>::LinSpaced(const Scalar& low, const Scalar& high) {
294  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
295  EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
296  return DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime,
297  internal::linspaced_op<Scalar>(low, high, Derived::SizeAtCompileTime));
298 }
299 
300 template <typename Derived>
301 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessEqualSpacedReturnType
302 DenseBase<Derived>::EqualSpaced(Index size, const Scalar& low, const Scalar& step) {
303  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
304  return DenseBase<Derived>::NullaryExpr(size, internal::equalspaced_op<Scalar>(low, step));
305 }
306 
307 template <typename Derived>
308 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessEqualSpacedReturnType
309 DenseBase<Derived>::EqualSpaced(const Scalar& low, const Scalar& step) {
310  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
311  return DenseBase<Derived>::NullaryExpr(Derived::SizeAtCompileTime, internal::equalspaced_op<Scalar>(low, step));
312 }
313 
315 template <typename Derived>
316 EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isApproxToConstant(const Scalar& val, const RealScalar& prec) const {
317  typename internal::nested_eval<Derived, 1>::type self(derived());
318  for (Index j = 0; j < cols(); ++j)
319  for (Index i = 0; i < rows(); ++i)
320  if (!internal::isApprox(self.coeff(i, j), val, prec)) return false;
321  return true;
322 }
323 
327 template <typename Derived>
328 EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isConstant(const Scalar& val, const RealScalar& prec) const {
329  return isApproxToConstant(val, prec);
330 }
331 
336 template <typename Derived>
337 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void DenseBase<Derived>::fill(const Scalar& val) {
338  setConstant(val);
339 }
340 
346 template <typename Derived>
347 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setConstant(const Scalar& val) {
348  internal::eigen_fill_impl<Derived>::run(derived(), val);
349  return derived();
350 }
351 
362 template <typename Derived>
363 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setConstant(Index size, const Scalar& val) {
364  resize(size);
365  return setConstant(val);
366 }
367 
380 template <typename Derived>
381 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setConstant(Index rows, Index cols,
382  const Scalar& val) {
383  resize(rows, cols);
384  return setConstant(val);
385 }
386 
394 template <typename Derived>
395 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setConstant(NoChange_t, Index cols,
396  const Scalar& val) {
397  return setConstant(rows(), cols, val);
398 }
399 
407 template <typename Derived>
408 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setConstant(Index rows, NoChange_t,
409  const Scalar& val) {
410  return setConstant(rows, cols(), val);
411 }
412 
429 template <typename Derived>
430 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(Index newSize, const Scalar& low,
431  const Scalar& high) {
432  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
433  return derived() = Derived::NullaryExpr(newSize, internal::linspaced_op<Scalar>(low, high, newSize));
434 }
435 
449 template <typename Derived>
450 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(const Scalar& low, const Scalar& high) {
451  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
452  return setLinSpaced(size(), low, high);
453 }
454 
455 template <typename Derived>
456 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setEqualSpaced(Index newSize, const Scalar& low,
457  const Scalar& step) {
458  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
459  return derived() = Derived::NullaryExpr(newSize, internal::equalspaced_op<Scalar>(low, step));
460 }
461 template <typename Derived>
462 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setEqualSpaced(const Scalar& low,
463  const Scalar& step) {
464  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
465  return setEqualSpaced(size(), low, step);
466 }
467 
468 // zero:
469 
484 template <typename Derived>
485 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ZeroReturnType DenseBase<Derived>::Zero(
486  Index rows, Index cols) {
487  return ZeroReturnType(rows, cols);
488 }
489 
506 template <typename Derived>
507 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ZeroReturnType DenseBase<Derived>::Zero(
508  Index size) {
509  return ZeroReturnType(size);
510 }
511 
522 template <typename Derived>
523 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ZeroReturnType DenseBase<Derived>::Zero() {
524  return ZeroReturnType(RowsAtCompileTime, ColsAtCompileTime);
525 }
526 
535 template <typename Derived>
536 EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isZero(const RealScalar& prec) const {
537  typename internal::nested_eval<Derived, 1>::type self(derived());
538  for (Index j = 0; j < cols(); ++j)
539  for (Index i = 0; i < rows(); ++i)
540  if (!internal::isMuchSmallerThan(self.coeff(i, j), static_cast<Scalar>(1), prec)) return false;
541  return true;
542 }
543 
551 template <typename Derived>
552 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setZero() {
553  internal::eigen_zero_impl<Derived>::run(derived());
554  return derived();
555 }
556 
566 template <typename Derived>
567 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setZero(Index newSize) {
568  resize(newSize);
569  return setZero();
570 }
571 
582 template <typename Derived>
583 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setZero(Index rows, Index cols) {
584  resize(rows, cols);
585  return setZero();
586 }
587 
595 template <typename Derived>
596 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setZero(NoChange_t, Index cols) {
597  return setZero(rows(), cols);
598 }
599 
607 template <typename Derived>
608 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setZero(Index rows, NoChange_t) {
609  return setZero(rows, cols());
610 }
611 
612 // ones:
613 
628 template <typename Derived>
629 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType DenseBase<Derived>::Ones(
630  Index rows, Index cols) {
631  return Constant(rows, cols, Scalar(1));
632 }
633 
650 template <typename Derived>
651 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType DenseBase<Derived>::Ones(
652  Index newSize) {
653  return Constant(newSize, Scalar(1));
654 }
655 
666 template <typename Derived>
667 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType DenseBase<Derived>::Ones() {
668  return Constant(Scalar(1));
669 }
670 
679 template <typename Derived>
680 EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isOnes(const RealScalar& prec) const {
681  return isApproxToConstant(Scalar(1), prec);
682 }
683 
691 template <typename Derived>
692 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setOnes() {
693  return setConstant(Scalar(1));
694 }
695 
705 template <typename Derived>
706 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setOnes(Index newSize) {
707  resize(newSize);
708  return setConstant(Scalar(1));
709 }
710 
721 template <typename Derived>
722 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setOnes(Index rows, Index cols) {
723  resize(rows, cols);
724  return setConstant(Scalar(1));
725 }
726 
734 template <typename Derived>
735 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setOnes(Index rows, NoChange_t) {
736  return setOnes(rows, cols());
737 }
738 
746 template <typename Derived>
747 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase<Derived>::setOnes(NoChange_t, Index cols) {
748  return setOnes(rows(), cols);
749 }
750 
751 // Identity:
752 
767 template <typename Derived>
768 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
770  return DenseBase<Derived>::NullaryExpr(rows, cols, internal::scalar_identity_op<Scalar>());
771 }
772 
783 template <typename Derived>
784 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
786  EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
787  return MatrixBase<Derived>::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_identity_op<Scalar>());
788 }
789 
799 template <typename Derived>
800 bool MatrixBase<Derived>::isIdentity(const RealScalar& prec) const {
801  typename internal::nested_eval<Derived, 1>::type self(derived());
802  for (Index j = 0; j < cols(); ++j) {
803  for (Index i = 0; i < rows(); ++i) {
804  if (i == j) {
805  if (!internal::isApprox(self.coeff(i, j), static_cast<Scalar>(1), prec)) return false;
806  } else {
807  if (!internal::isMuchSmallerThan(self.coeff(i, j), static_cast<RealScalar>(1), prec)) return false;
808  }
809  }
810  }
811  return true;
812 }
813 
814 namespace internal {
815 
816 template <typename Derived, bool Big = (Derived::SizeAtCompileTime >= 16)>
817 struct setIdentity_impl {
818  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Derived& run(Derived& m) {
819  return m = Derived::Identity(m.rows(), m.cols());
820  }
821 };
822 
823 template <typename Derived>
824 struct setIdentity_impl<Derived, true> {
825  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Derived& run(Derived& m) {
826  m.setZero();
827  const Index size = numext::mini(m.rows(), m.cols());
828  for (Index i = 0; i < size; ++i) m.coeffRef(i, i) = typename Derived::Scalar(1);
829  return m;
830  }
831 };
832 
833 } // end namespace internal
834 
842 template <typename Derived>
843 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity() {
844  return internal::setIdentity_impl<Derived>::run(derived());
845 }
846 
857 template <typename Derived>
858 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity(Index rows, Index cols) {
859  derived().resize(rows, cols);
860  return setIdentity();
861 }
862 
869 template <typename Derived>
870 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(
871  Index newSize, Index i) {
872  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
873  return BasisReturnType(SquareMatrixType::Identity(newSize, newSize), i);
874 }
875 
884 template <typename Derived>
885 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(
886  Index i) {
887  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
888  return BasisReturnType(SquareMatrixType::Identity(), i);
889 }
890 
898 template <typename Derived>
899 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitX() {
900  return Derived::Unit(0);
901 }
902 
910 template <typename Derived>
911 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitY() {
912  return Derived::Unit(1);
913 }
914 
922 template <typename Derived>
923 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitZ() {
924  return Derived::Unit(2);
925 }
926 
934 template <typename Derived>
935 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitW() {
936  return Derived::Unit(3);
937 }
938 
947 template <typename Derived>
948 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setUnit(Index i) {
949  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
950  eigen_assert(i < size());
951  derived().setZero();
952  derived().coeffRef(i) = Scalar(1);
953  return derived();
954 }
955 
965 template <typename Derived>
966 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setUnit(Index newSize, Index i) {
967  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
968  eigen_assert(i < newSize);
969  derived().resize(newSize);
970  return setUnit(i);
971 }
972 
973 } // end namespace Eigen
974 
975 #endif // EIGEN_CWISE_NULLARY_OP_H
Generic expression of a matrix where all coefficients are defined by a functor.
Definition: CwiseNullaryOp.h:63
bool isZero(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: CwiseNullaryOp.h:536
internal::traits< Derived >::Scalar Scalar
Definition: DenseBase.h:62
static const ZeroReturnType Zero()
Definition: CwiseNullaryOp.h:523
static const BasisReturnType UnitW()
Definition: CwiseNullaryOp.h:935
static const RandomAccessLinSpacedReturnType LinSpaced(Sequential_t, Index size, const Scalar &low, const Scalar &high)
Definition: CwiseNullaryOp.h:239
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
Derived & setIdentity()
Definition: CwiseNullaryOp.h:843
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:43
const unsigned int RowMajorBit
Definition: Constants.h:70
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:38
static const ConstantReturnType Constant(Index rows, Index cols, const Scalar &value)
Definition: CwiseNullaryOp.h:186
Derived & setOnes(Index size)
Definition: CwiseNullaryOp.h:706
Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:567
static const BasisReturnType UnitX()
Definition: CwiseNullaryOp.h:899
static const CwiseNullaryOp< CustomNullaryOp, PlainObject > NullaryExpr(Index rows, Index cols, const CustomNullaryOp &func)
Definition: CwiseNullaryOp.h:112
void fill(const Scalar &value)
Definition: CwiseNullaryOp.h:337
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82
bool isConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: CwiseNullaryOp.h:328
static const BasisReturnType UnitY()
Definition: CwiseNullaryOp.h:911
Derived & setConstant(Index size, const Scalar &val)
Definition: CwiseNullaryOp.h:363
static const BasisReturnType Unit(Index size, Index i)
Definition: CwiseNullaryOp.h:870
static const ConstantReturnType Ones()
Definition: CwiseNullaryOp.h:667
Derived & setLinSpaced(Index size, const Scalar &low, const Scalar &high)
Sets a linearly spaced vector.
Definition: CwiseNullaryOp.h:430
static const IdentityReturnType Identity()
Definition: CwiseNullaryOp.h:785
Derived & setZero()
Definition: CwiseNullaryOp.h:552
bool isApproxToConstant(const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: CwiseNullaryOp.h:316
Derived & setOnes()
Definition: CwiseNullaryOp.h:692
Derived & setConstant(const Scalar &value)
Definition: CwiseNullaryOp.h:347
const int Dynamic
Definition: Constants.h:25
bool isIdentity(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: CwiseNullaryOp.h:800
const NullaryOp & functor() const
Definition: CwiseNullaryOp.h:83
bool isOnes(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: CwiseNullaryOp.h:680
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
static const BasisReturnType UnitZ()
Definition: CwiseNullaryOp.h:923
Derived & setUnit(Index i)
Set the coefficients of *this to the i-th unit (basis) vector.
Definition: CwiseNullaryOp.h:948