User manual
mikroC PRO for dsPIC
MikroElektronika
681
Vector_Max
Prototype
unsigned Vector_Max(unsigned *srcV, unsigned numElems, unsigned
*MaxIndex);
Description This function nd maximal value in vector.
maxVal = max (srcV[n]), n ϵ [0, numElems-1]
If srcV[i] = srcV[j] = maxVal, and i < j, then maxIndex = j.
Parameters - srcV: pointer to original vector
- numElems: number of elements in vector(s)
- MaxIndex: pointer to index of maximum value
Returns Minimum value (maxVal).
Requires Nothing.
Example
unsigned vec1[3] = {1,2,3};
unsigned index;
unsigned rslt;
rslt = Vector_Max(vec1, 3, &index);
Notes - [W0..W5] used, not restored
Vector_Dot
Prototype
unsigned Vector_Dot(unsigned *v1, unsigned *v2, unsigned numElems);
Description Function calculates vector dot product.
Parameters - v1: pointer to rst vector
- v2: pointer to second vector
- numElems: number of elements in vector(s)
Returns Dot product value :
Requires Nothing.
Example
unsigned vec2[3] = {1,1,1};
unsigned rslt;
rslt = Vector_Dot(vec2,vec2,3);
Notes - [W0..W2] used, not restored
- [W4..W5] used, not restored
- AccuA used, not restored
- CORCON saved, used, restored