30.10.2014 Views

o_195h4n6al16jb186b1b2qs7fgssa.pdf

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

17 + 3(numElems)<br />

VectorMax<br />

Description: VectorMaxfinds the last element in the source vector whose value<br />

is<br />

greater than or equal to any previous vector element. Then, it outputs<br />

that maximum value and the index of the maximum element.<br />

Include: dsp.h<br />

Prototype: extern fractional VectorMax (<br />

int numElems,<br />

fractional* srcV,<br />

int* maxIndex<br />

);<br />

Arguments: numElems number of elements in source vector<br />

srcV pointer to source vector<br />

maxIndex pointer to holder for index of (last) maximum element<br />

Return Value: Maximum value in vector.<br />

Remarks: If srcV[i] = srcV[j] = maxVal, and i < j, then<br />

*maxIndex= j.<br />

Source File: vmax.asm<br />

dsPIC<br />

®<br />

Language Tools Libraries<br />

VectorMin<br />

Mô tả: VectorMinfinds yếu tố cuối cùng trong vector nguồn có giá trị<br />

nhỏ hơn hoặc bằng bất kỳ yếu tố vector trước. Sau đó, nó ra mà<br />

giá trị tối thiểu và chỉ số của các yếu tố tối thiểu.<br />

Bao gồm: dsp.h<br />

Nguyên mẫu: ở ngoài VectorMin phân đoạn (<br />

int numElems,<br />

phân đoạn * srcV,<br />

int * minIndex<br />

);<br />

Đối số: numElems số phần tử trong vector nguồn<br />

srcV con trỏ tới vector nguồn<br />

minIndex con trỏ để giữ cho chỉ số (cuối cùng) yếu tố tối thiểu<br />

Quay trở lại giá trị: giá trị tối thiểu trong vector.<br />

Ghi chú: Nếu srcV [i] = srcV [j] = minVal, và i srcV[n+1], 0 ≤n < numElems-1<br />

VectorMin<br />

Description: VectorMinfinds the last element in the source vector whose value<br />

is<br />

13<br />

Chu kỳ (bao gồm cả cuộc gọi C-chức năng và trả các chi phí):<br />

14<br />

nếu numElems = 1<br />

20 + 8 (numElems-2)<br />

nếu srcV [n] ≥ srcV [n + 1], 0 ≤n

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!