Random.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008 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_RANDOM_H
11 #define EIGEN_RANDOM_H
12 
13 namespace Eigen {
14 
15 namespace internal {
16 
17 template<typename Scalar> struct scalar_random_op {
19  template<typename Index>
20  inline const Scalar operator() (Index, Index = 0) const { return random<Scalar>(); }
21 };
22 
23 template<typename Scalar>
25 { enum { Cost = 5 * NumTraits<Scalar>::MulCost, PacketAccess = false, IsRepeatable = false }; };
26 
27 } // end namespace internal
28 
47 template<typename Derived>
50 {
51  return NullaryExpr(rows, cols, internal::scalar_random_op<Scalar>());
52 }
53 
74 template<typename Derived>
77 {
78  return NullaryExpr(size, internal::scalar_random_op<Scalar>());
79 }
80 
95 template<typename Derived>
98 {
99  return NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_random_op<Scalar>());
100 }
101 
109 template<typename Derived>
111 {
112  return *this = Random(rows(), cols());
113 }
114 
124 template<typename Derived>
125 EIGEN_STRONG_INLINE Derived&
127 {
128  resize(newSize);
129  return setRandom();
130 }
131 
142 template<typename Derived>
143 EIGEN_STRONG_INLINE Derived&
145 {
146  resize(nbRows, nbCols);
147  return setRandom();
148 }
149 
150 } // end namespace Eigen
151 
152 #endif // EIGEN_RANDOM_H
Generic expression of a matrix where all coefficients are defined by a functor.
#define EIGEN_EMPTY_STRUCT_CTOR(X)
Definition: XprHelper.h:22
#define EIGEN_STRONG_INLINE
internal::traits< Derived >::Index Index
The type of indices.
Definition: DenseBase.h:61
Derived & setRandom()
Definition: Random.h:110
internal::traits< Derived >::Index Index
Definition: LDLT.h:16
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:88
static const CwiseNullaryOp< internal::scalar_random_op< Scalar >, Derived > Random()
Definition: Random.h:97
const Scalar operator()(Index, Index=0) const
Definition: Random.h:20
Derived & setRandom(Index size)
Definition: Random.h:126


tuw_aruco
Author(s): Lukas Pfeifhofer
autogenerated on Mon Jun 10 2019 15:40:56