Function

vDSP_maxviD

Calculates the maximum value and corresponding index in a double-precision vector.

Declaration

void vDSP_maxviD(const double *__A, vDSP_Stride __IA, double *__C, vDSP_Length *__I, vDSP_Length __N);

Parameters

__A

Double-precision real input vector.

__I

Stride for A.

__C

Output scalar.

__IC

Output scalar index.

__N

The number of elements to process. If N is zero (0), this function returns -INFINITY in C, and the value in IC is undefined.

Discussion

This function calculates the maximum value and its corresponding index of the first N elements of A and writes the results to C and IC respectively:

A diagram showing the operation of the vDSP_maxvi function. There are three rows. The top row represents the input, vector A. The second row represents the maximum value operation. The bottom row represents the output, vector C. The diagram has connecting lines from the input vectors to the operation and from the operation to the output vector indicating the relationships between the input and output.

The index is the actual array index, not the pre-stride index. If vector A contains more than one instance of the maximum value, IC contains the index of the first instance.

The operation is:

*C = -INFINITY;
for (n = 0; n < N; ++n)
{
    if (*C < A[n * I])
    {
        *C = A[n * I];
        *IC = n * I;
    }
}

See Also

Maximum Calculation

vDSP_maxv

Calculates the maximum value in a single-precision vector.

vDSP_maxvD

Calculates the maximum value in a double-precision vector.

vDSP_maxvi

Calculates the maximum value and corresponding index in a single-precision vector.

vDSP_maxmgv

Calculates the maximum magnitude in a single-precision vector.

vDSP_maxmgvD

Calculates the maximum magnitude in a double-precision vector.

vDSP_maxmgvi

Calculates the maximum magnitude and corresponding index in a single-precision vector.

vDSP_maxmgviD

Calculates the maximum magnitude and corresponding index in a double-precision vector.