TVecInt.GatherByMask Method

function GatherByMask (const X: TMtxVecInt; const Mask: TMtxVecInt; const MaskNonZeroCount: integer = -1): TVecInt; overload;

Gathers the elements of X for which Mask holds a 1 to the calling object. Mask must hold only 0 and 1. MaskNonZeroCount, when not negative, is the number of ones in Mask; otherwise Mask.Sum() is used.

#NameTypeDescription
1XTMtxVecIntsource TVecInt or TMtxInt
2MaskTMtxVecIntsource TVecInt or TMtxInt
3MaskNonZeroCountinteger

Result: stored in self (calling object), returns self for chaining