YARP
Yet Another Robot Platform
RandnVector.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #include <yarp/math/RandnVector.h>
11 #include <yarp/sig/Vector.h>
12 
13 using namespace yarp::sig;
14 using namespace yarp::math;
15 using namespace yarp::math::impl;
16 
17 RandnVector::RandnVector(int s)
18 {
19  data.resize(s);
20 }
21 
22 void RandnVector::resize(int s)
23 {
24  data.resize(s);
25 }
26 
27 void RandnVector::init()
28 {
29  rnd.init();
30 }
31 
32 void RandnVector::init(int seed)
33 {
34  rnd.init(seed);
35 }
36 
37 const Vector &RandnVector::get(double u, double sigma)
38 {
39  for (size_t k=0;k<data.size(); k++)
40  {
41  data[k]=rnd.get(u, sigma);
42  }
43 
44  return data;
45 }
46 
47 const Vector &RandnVector::get(const Vector &u, const Vector &sigma)
48 {
49  for (size_t k=0;k<data.size(); k++)
50  {
51  data[k]=rnd.get(u[k], sigma[k]);
52  }
53 
54  return data;
55 }
Vector.h
contains the definition of a Vector type
yarp::sig
Signal processing.
Definition: Image.h:25
RandnVector.h
yarp::math
Definition: FrameTransform.h:18
yarp::sig::VectorOf< double >
yarp::math::impl
Definition: RandnVector.h:19