QScale2D
- Updated2023-02-21
- 2 minute(s) read
Advanced Analysis Library Only
AnalysisLibErrType QScale2D (void *inputArray, ssize_t numberOfRows, ssize_t numberOfColumns, void *outputArray, double *scalingFactor);
Purpose
Scales a 2D input array by its maximum absolute value. QScale2D can obtain the (i, j)th element of the scaled array using the following formula:

where scalingFactor is the maximum absolute value of the input array.
QScale2D determines the constant scale.
You can use this function instead of Scale2D, particularly if the expected mean value is 0. QScale2D can perform the operation in place; that is, the input and output arrays can be the same.
The following example uses the QScale2D function.
double inputData[10][10], scaledData[10][10];
double scalingFactor;
int i, j, numRows, numCols;
AnalysisLibErrType status;
numRows = 10;
numCols = 10;
/* Use a For loop to generate a 2D array of random numbers between 0.0 and 1.0*/
for (j = 0; j < 10; j++)
for (i = 0; i < 10; i++)
inputData[i][j] = Random(0.0, 1.0);
/* Scale inputData and return scaling factor*/
status = QScale2D(inputData, numRows, numCols, scaledData, &scalingFactor);
Parameters
Input | ||
Name | Type | Description |
inputArray | void * | Input array used as the basis for quick scaling. This matrix must be an array of doubles. |
numberOfRows | ssize_t | Number of rows used in the scaling operation. |
numberOfColumns | ssize_t | Number of columns used in the scaling operation. |
Output | ||
Name | Type | Description |
outputArray | void * | Scaled array, as an array of doubles. |
scalingFactor | double | The maximum absolute value in the input array. |
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. |
Additional Information
Library: Advanced Analysis Library
Include file: analysis.h
LabWindows/CVI compatibility: LabWindows/CVI 3.1 and later