You are here: Symbol Reference > clMtxExpr Namespace > Classes > clVector Record > public > Select Method > clVector.Select Method (integer, integer)
MtxVec VCL
ContentsIndex
PreviousUpNext
clVector.Select Method (integer, integer)

Selects a set of elements from the vector.

Pascal
procedure Select(Index: integer; Len: integer); overload;

The method will define a subarray starting at Index and ending at Index+Len-1. No copying will occur, only pointers will be shifted. 

All values of the original TMtxVec will be preserved. An exception will be raised if an attempt is made to change the size of the calling object after a selection has been made. 

A selection will behave exactly as if the object always contained only the selected values. When a selection is made from another object the source object and all operations done on either of the two objects will affect the same elements. The use of selections increases CPU cache reuse, lower's memory requirements, increases application performance and improves code readability. 

To again obtain a view of the full vector/matrix use the SelectAll method. 

When selecting elements from other objects, care must be given not to use the selections after the source object has been freed: 

 

var a,b: TOpenCLVector; begin CreateIt(a,b); try a.SetIt(False,[1,2,3,4]); b.Select(a,2,2); FreeIt(a); //free the source object b.Values[0] := b.Valuess[1]; //b does not point to valid memory anymore finally FreeIt(a); end; end;
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!