ocmath_d_copy
Description
Copy a vector of type double with given array of indices.
Syntax
void ocmath_d_copy( uint nPts, const uint * pIndices, double * pDestX, const double * pSrcX, int nSrcSize )
Parameters
- nPts
- [input] size of pIndices arrays, must be smaller then the size of pSrcX.
- pIndices
- [input] array of indices to copy from pSrcX to pDestX, the largest
- element of this array must be smaller then the size of pDestX.
- pDestX
- [output] destination vector, must be SetSize to nPts.
- pSrcX
- [input] source vector, must be SetSize to at least the largest element in pIndices.
- nSrcSize
- [input] the size of source vector.
Return
There is nothing to return, It is assumed that caller will prepare all the
pointers and arrays such that they are all in the valid range, as this
function does not check for errors.
Examples
EX1
#include <Origin.h>
#include <ocmath.h>
void ocmath_d_copy_ex1()
{
vector vd = {1,1.1, 2 ,2.1, 3,3.1,4,4.1,5,5.1};
vector<uint> vnIndices = {0,2,4,6,8};
vector vDestX;
bool bRet = vDestX.SetSize(vnIndices.GetSize());
if(!bRet)
return ;
ocmath_d_copy(vnIndices.GetSize(), vnIndices,vDestX, vd, vd.GetSize() );
//vDestX should have data of : 1, 2, 3, 4, 5
}
Remark
Copy source vector's elements indexed by pIndice to destination array.
Data types supported:
double: ocmath_d_copy
float: ocmath_f_copy
unsigned short: ocmath_us_copy
unsigned int: ocmath_ui_copy
unsigned char: ocmath_b_copy
See Also
ocmath_f_copy, ocmath_ui_copy, ocmath_us_copy, ocmath_b_copy
header to Include
origin.h
Reference
|