cisst-saw
Toggle main menu visibility
Loading...
Searching...
No Matches
tmp
cisst-saw
cisst
cisstVector
vctRandomFixedSizeVector.h
Go to the documentation of this file.
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3
4
/*
5
Author(s): Anton Deguet
6
Created on: 2007-02-11
7
8
(C) Copyright 2003-2026 Johns Hopkins University (JHU), All Rights Reserved.
9
10
--- begin cisst license - do not edit ---
11
12
This software is provided "as is" under an open source license, with
13
no warranty. The complete license can be found in license.txt and
14
http://www.cisst.org/cisst/license.txt.
15
16
--- end cisst license ---
17
*/
18
19
#pragma once
20
#ifndef _vctRandomFixedSizeVector_h
21
#define _vctRandomFixedSizeVector_h
22
27
28
#include <
cisstCommon/cmnRandomSequence.h
>
29
#include <
cisstCommon/cmnPortability.h
>
30
31
#include <
cisstVector/vctForwardDeclarations.h
>
32
#include <
cisstVector/vctFixedSizeVector.h
>
33
46
template
<vct::
size_t
ype _size, vct::str
id
e_type _str
id
e,
class
_elementType,
class
_dataPtrType>
47
void
vctRandom
(
vctFixedSizeVectorBase<_size, _stride, _elementType, _dataPtrType>
& vector,
48
const
_elementType min,
49
const
_elementType max) {
50
cmnRandomSequence
& randomSequence =
cmnRandomSequence::GetInstance
();
51
typedef
vctFixedSizeVectorBase<_size, _stride, _elementType, _dataPtrType>
VectorType;
52
const
typename
VectorType::iterator
end
= vector.
end
();
53
typename
VectorType::iterator iter;
54
for
(iter = vector.
begin
(); iter !=
end
; ++iter) {
55
randomSequence.
ExtractRandomValue
(min, max,
56
*iter);
57
}
58
}
59
60
template
<
class
_elementType, vct::
size_t
ype _size, vct::str
id
e_type _str
id
e>
61
void
vctRandom
(
vctFixedSizeVectorRef<_elementType, _size, _stride>
&& vector,
62
const
_elementType min,
63
const
_elementType max) {
64
typename
vctFixedSizeVectorRef<_elementType, _size, _stride>::BaseType
& base = vector;
65
vctRandom
(base, min, max);
66
}
67
68
#endif
// _vctRandomFixedSizeVector_h
cmnRandomSequence
Provide an interface to a reproducible random sequence.
Definition
cmnRandomSequence.h:67
cmnRandomSequence::GetInstance
static cmnRandomSequence & GetInstance(void)
Definition
cmnRandomSequence.h:138
cmnRandomSequence::ExtractRandomValue
void ExtractRandomValue(_valueType &result)
vctFixedSizeVectorBase
A template for a fixed length vector with fixed spacing in memory.
Definition
vctFixedSizeVectorBase.h:77
vctFixedSizeVectorBase::begin
iterator begin(void)
Definition
vctFixedSizeVectorBase.h:117
vctFixedSizeVectorBase::end
iterator end(void)
Definition
vctFixedSizeVectorBase.h:130
vctFixedSizeVectorRef
Definition
vctForwardDeclarations.h:89
cmnPortability.h
Portability across compilers and operating systems tools.
cmnRandomSequence.h
Randomization utilities for general use in CISST applications.
vctRandom
void vctRandom(vctDynamicMatrixBase< _matrixOwnerType, _elementType > &matrix, const typename vctDynamicMatrixBase< _matrixOwnerType, _elementType >::value_type min, const typename vctDynamicMatrixBase< _matrixOwnerType, _elementType >::value_type max)
Definition
vctRandomDynamicMatrix.h:47
end
const_iterator end(void) const
Definition
vctDynamicConstMatrixBase.h:209
vctFixedSizeVector.h
Declaration of vctFixedSizeVector.
vctForwardDeclarations.h
Forward declarations and #define for cisstVector.
Generated by
1.18.0