Mikroelektronika MIKROE-724 データシート
648
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
Vector_Max
Prototype
sub function Vector_Max(dim byref Vector as word[1024], dim numElems as
word, dim byref MaxIndex as word) as word
Description This function find 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
- Vector:
original vector
- numElems:
number of elements in vector(s)
- MaxIndex:
index of maximum value
Returns
Minimum value (
maxVal
).
Requires
Nothing.
Example
dim vec1 as word[3]
index, rslt as word
rslt = Vector_Max(vec1, 3, index)
Notes
- [W0..W5] used, not restored
Vector_Dot
Prototype
sub function Vector_Dot(dim byref v1, v2 as word[1024], dim numElems as
word) as word
Description Function calculates vector dot product.
Parameters
Parameters
- v1:
first vector
- v2:
second vector
- numElems:
number of elements in vector(s)
Returns
Dot product value:
Requires
Nothing.
Example
dim vec1 as word[3]
rslt = Vector_Dot(vec1,vec1,3)
Notes
- [W0..W2] used, not restored
- [W4..W5] used, not restored
- AccuA used, not restored
- CORCON saved, used, restored