gtsam
3rdparty
Eigen
Eigen
src
Core
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
{
18
EIGEN_EMPTY_STRUCT_CTOR
(
scalar_random_op
)
19
inline const
Scalar
operator() ()
const
{
return
random<Scalar>(); }
20
};
21
22
template
<
typename
Scalar>
23
struct
functor_traits
<
scalar_random_op
<
Scalar
> >
24
{
enum
{
Cost
= 5 *
NumTraits<Scalar>::MulCost
,
PacketAccess
=
false
,
IsRepeatable
=
false
}; };
25
26
}
// end namespace internal
27
54
template
<
typename
Derived>
55
inline
const
typename
DenseBase<Derived>::RandomReturnType
56
DenseBase<Derived>::Random
(
Index
rows
,
Index
cols
)
57
{
58
return
NullaryExpr(
rows
,
cols
,
internal::scalar_random_op<Scalar>
());
59
}
60
85
template
<
typename
Derived>
86
inline
const
typename
DenseBase<Derived>::RandomReturnType
87
DenseBase<Derived>::Random
(
Index
size
)
88
{
89
return
NullaryExpr(
size
,
internal::scalar_random_op<Scalar>
());
90
}
91
111
template
<
typename
Derived>
112
inline
const
typename
DenseBase<Derived>::RandomReturnType
113
DenseBase<Derived>::Random
()
114
{
115
return
NullaryExpr(RowsAtCompileTime, ColsAtCompileTime,
internal::scalar_random_op<Scalar>
());
116
}
117
130
template
<
typename
Derived>
131
EIGEN_DEVICE_FUNC
inline
Derived&
DenseBase<Derived>::setRandom
()
132
{
133
return
*
this
= Random(
rows
(),
cols
());
134
}
135
149
template
<
typename
Derived>
150
EIGEN_STRONG_INLINE
Derived&
151
PlainObjectBase<Derived>::setRandom
(
Index
newSize)
152
{
153
resize
(newSize);
154
return
setRandom
();
155
}
156
172
template
<
typename
Derived>
173
EIGEN_STRONG_INLINE
Derived&
174
PlainObjectBase<Derived>::setRandom
(
Index
rows
,
Index
cols
)
175
{
176
resize
(
rows
,
cols
);
177
return
setRandom
();
178
}
179
191
template
<
typename
Derived>
192
EIGEN_STRONG_INLINE
Derived&
193
PlainObjectBase<Derived>::setRandom
(
NoChange_t
,
Index
cols
)
194
{
195
return
setRandom
(
rows
(),
cols
);
196
}
197
209
template
<
typename
Derived>
210
EIGEN_STRONG_INLINE
Derived&
211
PlainObjectBase<Derived>::setRandom
(
Index
rows
,
NoChange_t
)
212
{
213
return
setRandom
(
rows
,
cols
());
214
}
215
216
}
// end namespace Eigen
217
218
#endif // EIGEN_RANDOM_H
EIGEN_EMPTY_STRUCT_CTOR
#define EIGEN_EMPTY_STRUCT_CTOR(X)
Definition:
XprHelper.h:22
EIGEN_DEVICE_FUNC
#define EIGEN_DEVICE_FUNC
Definition:
Macros.h:976
Eigen
Namespace containing all symbols from the Eigen library.
Definition:
jet.h:637
Eigen::PlainObjectBase::setRandom
Derived & setRandom(Index size)
Definition:
Random.h:151
setRandom
A setRandom()
resize
v resize(3)
Eigen::internal::scalar_random_op
Definition:
Random.h:17
Eigen::NoChange_t
NoChange_t
Definition:
Constants.h:360
rows
int rows
Definition:
Tutorial_commainit_02.cpp:1
Eigen::CwiseNullaryOp
Generic expression of a matrix where all coefficients are defined by a functor.
Definition:
CwiseNullaryOp.h:60
size
Scalar Scalar int size
Definition:
benchVecAdd.cpp:17
EIGEN_STRONG_INLINE
#define EIGEN_STRONG_INLINE
Definition:
Macros.h:917
Eigen::DenseBase::Random
static const RandomReturnType Random()
Definition:
Random.h:113
Eigen::internal::functor_traits::IsRepeatable
@ IsRepeatable
Definition:
XprHelper.h:181
Eigen::internal::functor_traits::PacketAccess
@ PacketAccess
Definition:
XprHelper.h:180
Eigen::internal::functor_traits::Cost
@ Cost
Definition:
XprHelper.h:179
Eigen::internal::functor_traits
Definition:
XprHelper.h:175
internal
Definition:
BandTriangularSolver.h:13
cols
int cols
Definition:
Tutorial_commainit_02.cpp:1
Eigen::DenseBase::setRandom
EIGEN_DEVICE_FUNC Derived & setRandom()
Definition:
Random.h:131
Eigen::NumTraits
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition:
NumTraits.h:232
Scalar
SCALAR Scalar
Definition:
bench_gemm.cpp:46
Eigen::Index
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition:
Meta.h:74
gtsam
Author(s):
autogenerated on Thu Dec 19 2024 04:02:45