| Motorola DSP Developer's Kit | ![]() |
[yr, yi, index] = mot###_max( X )
Description
This function returns the largest element of input complex vector X and its index
Input/Output
Input: Complex vector X (includes real part Xr and imaginary part Xi)
Output: Complex vector Y (includes real data of the largest element Yr, and the imaginary data of the largest element Yi), and index
Algorithm
#define IN 0
MaxValue = 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 > MaxValue)
{
MaxValue = Intervalue;
Yr = Xr[i];
Yi = Xi[i];
index = i;
}
}
Memory & Register
Status Register
The assembly function max-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
The value of input vector X must be between -1.0 and +1.0.
Precision
In the case of DSP563, precision is 23 bits.
In the case of DSP566, precision is 15 bits.
| max-1r.asm | max-2r.asm | ![]() |