cisst-saw
Toggle main menu visibility
Loading...
Searching...
No Matches
tmp
cisst-saw
cisst
cisstVector
vctRandomFixedSizeMatrix.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 _vctRandomFixedSizeMatrix_h
21
#define _vctRandomFixedSizeMatrix_h
22
27
28
#include <
cisstCommon/cmnRandomSequence.h
>
29
#include <
cisstCommon/cmnPortability.h
>
30
31
#include <
cisstVector/vctForwardDeclarations.h
>
32
#include <
cisstVector/vctFixedSizeMatrix.h
>
33
46
template
<
vct::size_type
_rows,
vct::size_type
_cols,
47
vct::stride_type
_rowStride,
vct::stride_type
_colStride,
48
class
_elementType,
class
_dataPtrType>
49
void
vctRandom
(
vctFixedSizeMatrixBase
<_rows, _cols, _rowStride, _colStride,
50
_elementType, _dataPtrType> & matrix,
51
const
_elementType min,
52
const
_elementType max) {
53
cmnRandomSequence
& randomSequence =
cmnRandomSequence::GetInstance
();
54
typedef
vctFixedSizeMatrixBase<_rows, _cols, _rowStride, _colStride, _elementType, _dataPtrType>
MatrixType;
55
const
typename
MatrixType::iterator
end
= matrix.end();
56
typename
MatrixType::iterator iter;
57
for
(iter = matrix.begin(); iter !=
end
; ++iter) {
58
randomSequence.
ExtractRandomValue
(min, max,
59
*iter);
60
}
61
}
62
63
template
<
class
_elementType,
vct::size_type
_rows,
vct::size_type
_cols,
64
vct::stride_type
_rowStride,
vct::stride_type
_colStride>
65
void
vctRandom
(
vctFixedSizeMatrixRef<_elementType, _rows, _cols, _rowStride, _colStride>
&& matrix,
66
const
_elementType min,
67
const
_elementType max) {
68
typename
vctFixedSizeMatrixRef<_elementType, _rows, _cols, _rowStride, _colStride>::BaseType
& base = matrix;
69
vctRandom
(base, min, max);
70
}
71
72
#endif
// _vctRandomFixedSizeMatrix_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)
vctFixedSizeMatrixBase
A template for a fixed size matrix with fixed spacings in memory.
Definition
vctFixedSizeMatrixBase.h:60
vctFixedSizeMatrixRef
Definition
vctForwardDeclarations.h:110
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
vct::size_type
size_t size_type
Definition
vctContainerTraits.h:35
vct::stride_type
ptrdiff_t stride_type
Definition
vctContainerTraits.h:37
end
const_iterator end(void) const
Definition
vctDynamicConstMatrixBase.h:209
vctFixedSizeMatrix.h
Declaration of vctFixedSizeMatrix.
vctForwardDeclarations.h
Forward declarations and #define for cisstVector.
Generated by
1.18.0