Motorola DSP Developer's Kit | ![]() ![]() |
[y, index] = mot###_min( X )
Description
This function returns the smallest element of complex input vector X and its index
Input/Output
Input: Complex vector X, include real part Xr and imaginary part Xi
Output: scalar y, include yr (real data of the smallest element of X), yi (imaginary data of the smallest element of X), index
Algorithm
#define IN0 MinValue = Xr[0]* Xr[0] + Xi[0]* Xi[0]; yr = Xr[0]; yi = Xi[0]; Index = 0; for(i=1; i<size; i++) { Intervalue = Xr[i]* Xr[i] + Xi[i]* Xi[i]; if(Intervalue < MinValue) { MinValue = Intervalue; yr = Xr[i]; yi = Xi[i]; index = i; } }
Memory & Register
X memory IN_REAL = start address of real data
Y memory IN_IMAG = start address of imaginary data
IN = address offset of input complex vector X
Register X1 = real data of the result
R7 = number of items in the array
Status Register
The assembly function min-1c.asm does not explicitly set any status registers/bits during the function execution.
Data Size Limit
The length of vector X can't be larger than the continuous available data memory size.
Data Range Limit
Input data vector X range [-1.0, +1.0]
Precision
In the case of DSP563, precision is 23 bits.
In the case of DSP566, precision is 15 bits.
![]() | min-1r.asm | min-2r.asm | ![]() |