2.3.10 VectorPower

Description

VectorPower computes the power of a source vector as the sum of the squares of its elements.

Prototype

fractional VectorPower(int numElems, fractional* srcV);

Arguments

Parameters

Description

numElems

Number of elements in the source vectors

srcV

Pointer to the source vector

Returns

Value of the vector’s power (sum of squares).

Remarks

If the absolute value of sum-of-squares is larger than the maximum value of 1.31 fractional data type, the operation results in saturation.

This function can be self-applicable.

Source File

  • vpow_aa.s

Function Profile

Device

Program Words

Cycles

PIC32A

9

36 + (numElems)

System resource usage

  • W0…W4 - used, not restored
  • ACCA - used, not restored
  • CORCON - saved, used, restored
  • One REPEAT instruction