MeanOfLayersToArray

Declaration: TMat4D.MeanOfLayersToArray (var DestMat: TDouble2DArray; LowCol, HighCol, LowRow, HighRow, LowLayer, HighLayer, LowTimeSlot, HighTimeSlot, NThreads: integer);
The method MeanOfLayersToArray calculates the elementwise mean of several two-dimensional submatrices and copies the result into the matrix DestMat. The range of each submatrix is specified by the parameters LowCol, HighCol, LowRow, and HighRow. The submatrices are specified by the parameters LowLayer, HighLayer, LowTimeSlot and HighTimeSlot. The destination matrix DestMat is automatically resized to accomodate the number of processed data cells.

The parameter NThreads controls the number of CPU cores to be used for the calculation. The valid range of NThreads is from 1 to CPUCount, any value beyond this range is automatically restricted to the nearest limit. Please note that setting the NThreads to CPUCount will block your system during the calculations, thus it is recommended to set NThreads not higher than CPUCount-1.

As a shortcut, setting both the Low.... and High.... parameters to zero is equal to processing the entire range of available columns/rows/layers/time slots.

Example: The statement MeanOfLayersToArray (MaxMat,2,4,2,7,0,0,1,1,3); calculates the mean of all matrix elements in the columns 2..4 and rows 2..7 for all layers in time slot 1 and stores the result in matrix MaxMat. The calculation if distributed over three threads.


Last Update: 2020-Jšn-04