MaxMin2D

AnalysisLibErrType MaxMin2D (void *inputArray, int numberRows, int numberColumns, double *maxValue, int *maxRowIndex, int *maxColumnIndex, double *minValue, int *minRowIndex, int *minColumnIndex);

Purpose

Finds the maximum and the minimum values in the 2D input array and the their locations in the array. If there are multiple instances of the maximum and/or minimum values, MaxMin2D returns the location of the first occurrence.

MaxMin2D scans the inputArray array by rows.

Example

/* This example finds the maximum and minimum values and their location within the array. */
double x[5][10], maxValue, minValue;
int n, m, imax, jmax, imin, jmin;
n = 5;
m = 10;
MaxMin2D (x, n, m, &max, &imax, &jmax, &min, &imin, &jmin);

Parameters

Input
Name Type Description
inputArray numeric array Input array whose maximum and minimum values are determined. This array must be an array of doubles.
numberRows integer Number of rows used to determine the maximum and minimum values.
numberColumns integer Number of columns used to determine the maximum and minimum values.
Output
Name Type Description
maxValue double-precision Maximum value found in inputArray.
maxRowIndex integer Row index of the maximum value found in inputArray.
maxColumnIndex integer Column index of the maximum value found in inputArray.
minValue double-precision Minimum value found in the inputArray.
minRowIndex integer Row index of the minimum value found in inputArray.
minColumnIndex integer Column index of the minimum value found in inputArray.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.