Developer Reference

Computing Minimum/Maximum Values

Use the
VSL_SS_METHOD_FAST
method to compute the minimum/maximum values in the datasets. The calculation is straightforward and follows the pattern of the example below:
#include "mkl_vsl.h" #define DIM 3 /* dimension of the task */ #define N 1000 /* number of observations */ int main() { VSLSSTaskPtr task; float x[DIM][N]; /* matrix of observations */ float min_est[DIM], max_est[DIM]; MKL_INT p, n, xstorage; int status; /* Parameters of the task and initialization */ p = DIM; n = N; xstorage = VSL_SS_MATRIX_STORAGE_ROWS; for ( int i = 0; i < p; i++ ) min_est[i] = max_est[i] = x[i][0]; /* Create a task */ status = vslsSSNewTask( &task, &p, &n, &xstorage, (float*)x, 0, 0 ); /* Initialize the task parameters */ status = vslsSSEditTask( task, VSL_SS_ED_MIN, min_est ); status = vslsSSEditTask( task, VSL_SS_ED_MAX, max_est ); /* Compute the minimum and maximum values in observations */ status = vslsSSCompute( task, VSL_SS_MIN|VSL_SS_MAX, VSL_SS_METHOD_FAST ); /* Deallocate the task resources */ status = vslSSDeleteTask( &task ); return 0; }
The size of the arrays to hold the minimum/maximum values should be sufficient for storing at least
p
values of each estimate, where
p
is the dimension of the task.
You can use the computation of these estimates to find the minimum/maximum values in the dataset available in blocks. In this case, the estimates computed for the previous data portion are used for processing the next block of the data array.
Before the first call to the
Compute
routine, initialize the initial values of the estimates with reasonable values, such as the values of the first observation.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804