TOpenCLVector.PowerSpectrum Method

function PowerSpectrum(const Vec: TOpenCLMtxVec): TOpenCLMtxVec;

The power spectrum from object complex values.

#NameTypeDescription
1VecTOpenCLMtxVecsource TOpenCLVector or TOpenCLMatrix

Result: stored in self (calling object), returns self for chaining

Remarks:

Calculates the power spectrum from the Vec object complex values and stores the results (power spectrum) in the real calling object. Size and TOpenCLBase.Complex properties of the calling object are set implicitly to match Vec object. The spectrum elements are squares of the magnitudes of the complex input elements:

Spect[k]=((Vec[k]))2+((Vec[k]))2\text{Spect}[k] = \left(\Re (\text{Vec}[k]) \right)^2 + \left(\Im (\text{Vec}[k]) \right)^2
Examples
var a,b: clVector;
begin
    a.CopyFromArray(TSingleArray.Create(1,2,3,-4)); // a = [1 + 2i, 3 - 4i]
    b.PowerSpectrum(a);   // b = [1*1 + 2*2, 3*3+(-4)*(-4)]
end;

Indexed: function PowerSpectrum(const Vec: TOpenCLMtxVec; VecIndex: Integer; Index: Integer; Len: Integer): TOpenCLMtxVec;

Calculates the power spectrum from the Vec complex elements [VecIndex]..[VecIndex+Len-1].

#NameTypeDescription
1VecTOpenCLMtxVecsource TOpenCLVector or TOpenCLMatrix
2VecIndexInteger
3IndexIntegerstart index
4LenIntegerelement count

Result: stored in self (calling object), returns self for chaining

Remarks:

Store the results in calling object real elements [Index]..[Index+Len-1]. An exception is raised if calling object TOpenCLBase.Complex property is true or if array borders are overrun/underrun.