30.10.2014 Views

o_195h4n6al16jb186b1b2qs7fgssa.pdf

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

which<br />

is a vector. When the result is also a vector, this is referred to as the destination<br />

vector.<br />

Some operations resulting in a vector allow computation in place. This means<br />

the<br />

results of the operation are placed back into the source vector (or the source one<br />

vector<br />

for binary operations). In this case, the destination vector is said to (physically)<br />

replace<br />

the source (one) vector. If an operation can be computed in place, it is indicated<br />

as such<br />

in the comments provided with the function description.<br />

For some binary operations, the two operands can be the same (physical) source<br />

vector, which means the operation is applied to the source vector and itself. If<br />

this type<br />

of computation is possible for a given operation,it is indicated as such in the<br />

comments<br />

provided with the function description.<br />

Some operations can be both self applicable and computed in place.<br />

All the fractional vector operations in thislibrary take as an argument the<br />

cardinality<br />

(number of elements) of the operand vector(s). Based on the value of this<br />

argument the<br />

following assumptions are made:<br />

a) The sum of sizes of all the vectors involved in a particular operation falls<br />

within<br />

the range of available data memory for the target device.<br />

b) In the case of binary operations, the cardinalities of both operand vectors<br />

must<br />

obey the rules of vector algebra (particularly, see remarks for the<br />

VectorConvolveand VectorCorrelatefunctions).<br />

c) The destination vector mustbe large enough to accept the results of an<br />

operation.<br />

dsPIC<br />

®<br />

Language Tools Libraries<br />

DS51456B-page 14<br />

2.3.2 User Considerations<br />

2004 Microchip Technology Inc.<br />

a) No boundary checking is performed by these functions. Out of range<br />

cardinalities<br />

(including zero length vectors) as well as nonconforming use of source vector<br />

sizes in binary operations may produce unexpected results.<br />

b) The vector addition and subtraction operations could lead to saturation if the<br />

sum<br />

of corresponding elements in the source vector(s) is greater than 1-2<br />

vi cardinalities<br />

(Bao gồm cả không vector chiều dài) cũng như sử dụng không phù hợp của<br />

vector nguồn<br />

kích thước trong các hoạt động nhị phân có thể tạo ra kết quả bất ngờ.<br />

b) Các cộng và trừ các hoạt động vector có thể dẫn đến bão hòa nếu tổng<br />

các yếu tố tương ứng trong vector nguồn (s) lớn hơn 1-2<br />

-15<br />

hoặc<br />

nhỏ hơn -1,0. Tương tự, các vector chấm sản phẩm và các hoạt động năng lượn<br />

có thể dẫn đến bão hòa nếu tổng sản phẩm lớn hơn 1-2<br />

-15<br />

hoặc nhỏ hơn<br />

hơn -1,0.<br />

c) Đó là khuyến cáo rằng tình trạng đăng ký (SR) được xem xét sau khi hoàn<br />

thành<br />

mỗi lần gọi hàm. Đặc biệt, người dùng có thể kiểm tra việc SA, SB và SAB cờ<br />

sau<br />

hàm trả về để xác định độ bão hòa xảy ra.<br />

d) Tất cả các chức năng đã được thiết kế để hoạt động trên các vector phân đoạn<br />

phân bổ<br />

trong không gian bộ nhớ RAM mặc định (X-Y-dữ liệu hoặc dữ liệu).<br />

e) Các hoạt động đó trả về một vector đích có thể được lồng vào nhau, do đó, v<br />

dụ<br />

nếu:<br />

a = OP1 (b, c), với b = OP2 (d) và c = op3 (e, f), sau đó<br />

a = OP1 (OP2 (d), op3 (e, f))<br />

2.3.3 Bình luận khác<br />

Mô tả các chức năng giới hạn phạm vi của nó những gì có thể được coi là<br />

thường xuyên<br />

sử dụng các hoạt động này. Tuy nhiên, vì không có kiểm tra biên giới được thự<br />

hiện trong quá trình<br />

tính toán của các chức năng này, bạn có quyền tự do để giải thích các hoạt động<br />

của mình và<br />

kết quả là nó phù hợp với một số nhu cầu đặc biệt.<br />

Ví dụ, trong khi tính toán VectorMaxfunction, chiều dài của vector nguồn<br />

có thể là lớn hơn numElems. Trong trường hợp này, các chức năng sẽ được sử<br />

dụng để tìm<br />

giá trị tối đa onlyamong các numElemselements đầu tiên của vector nguồn.<br />

Một ví dụ khác, bạn có thể quan tâm đến việc thay thế numElemselements của<br />

một vector điểm nằm giữa Nand N + numElems-1, với numElemselements từ<br />

một vector nguồn nằm giữa các yếu tố mand M + numElems-1. Sau đó,<br />

VectorCopyfunction có thể được sử dụng như sau:<br />

phân đoạn * DSTV [DST_ELEMS] = {...};<br />

phân đoạn * srcV [SRC_ELEMS] = {...};

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

Saved successfully!

Ooh no, something went wrong!