MtxVec VCL
|
Gather vector elements.
Gather the elements of vector X and store them to the calling vector according to the IndexType, Increment and Offset parameters.
The Indexes vector is used only if IndexType is either indVector or indMask. If IndexType is indVector, the values from the Indexes vector denote the index positions in the X vector from which the values should be copied to the calling vector. The Indexes vector must have the indexes stored in the IValues array. The IValues integer arrays points the same memory as Values array.
The Increment and Offset parameters are used only if TIndexType is indIncrement. They define the initial offset and a fixed step (increment) between elements to be gathered. If IndexType is indMaks the Indexes vector must have the same size as the X vector. The routine will copy only those elements from the X vector to the calling vector, for which there is a 1 at the coresponding index in the Indexes vector.
The elements copied from the X vector will be stored consecutively in the calling vector.
See the Scatter method to see how to undo the gathering.
The performance of the CPU heavily depends on the assumption that elements are stored at consecutive memory locations. If it is neccessary to apply a set of operations only to elements at specific indexes, performance-wise it can proof to be very helpfull, if the elements are gathered first.
Vector.Gather, VectorInt.Gather, Scatter
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
|
What do you think about this topic? Send feedback!
|