cisst-saw
Toggle main menu visibility
Loading...
Searching...
No Matches
tmp
cisst-saw
cisst
cisstVector
vctRandomDynamicVector.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 _vctRandomDynamicVector_h
21
#define _vctRandomDynamicVector_h
22
27
28
#include <
cisstCommon/cmnRandomSequence.h
>
29
#include <
cisstCommon/cmnPortability.h
>
30
31
#include <
cisstVector/vctForwardDeclarations.h
>
32
#include <
cisstVector/vctDynamicVector.h
>
33
46
template
<
class
_vectorOwnerType,
typename
_elementType>
47
void
vctRandom
(
vctDynamicVectorBase<_vectorOwnerType, _elementType>
& vector,
48
const
typename
vctDynamicVectorBase<_vectorOwnerType, _elementType>::value_type
min,
49
const
typename
vctDynamicVectorBase<_vectorOwnerType, _elementType>::value_type
max)
50
{
51
cmnRandomSequence
& randomSequence =
cmnRandomSequence::GetInstance
();
52
typedef
vctDynamicVectorBase<_vectorOwnerType, _elementType>
VectorType;
53
const
typename
VectorType::iterator
end
= vector.
end
();
54
typename
VectorType::iterator iter;
55
for
(iter = vector.
begin
(); iter !=
end
; ++iter) {
56
randomSequence.
ExtractRandomValue
(min, max,
57
*iter);
58
}
59
}
60
61
template
<
typename
_elementType>
62
void
vctRandom
(
vctDynamicVectorRef<_elementType>
&& vector,
63
const
typename
vctDynamicVectorRef<_elementType>::value_type
min,
64
const
typename
vctDynamicVectorRef<_elementType>::value_type
max)
65
{
66
typename
vctDynamicVectorRef<_elementType>::BaseType
& base = vector;
67
vctRandom
(base, min, max);
68
}
69
70
#endif
// _vctRandomDynamicVector_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)
vctDynamicVectorBase
Definition
vctDynamicVectorBase.h:62
vctDynamicVectorBase::end
iterator end(void)
Definition
vctDynamicVectorBase.h:97
vctDynamicVectorBase::begin
iterator begin(void)
Definition
vctDynamicVectorBase.h:91
vctDynamicVectorRef
Dynamic vector referencing existing memory.
Definition
vctDynamicVectorRef.h:78
vctDynamicVectorRef::BaseType
vctDynamicVectorBase< vctDynamicVectorRefOwner< _elementType >, _elementType > BaseType
Definition
vctDynamicVectorRef.h:83
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
vctDynamicVector.h
Declaration of vctDynamicVector.
vctForwardDeclarations.h
Forward declarations and #define for cisstVector.
Generated by
1.18.0