Summary
Resizes vector size while preserving values.
Class
TVec
Declaration
Function Resize(Len: integer; ZeroIt: boolean = False): TMtxVec;
Description
Resizes calling vector
Length to Len. If
Length is less than Len and ZeroIt parameter is true, the remaining calling vector values are set to zero.
Example 1
var a: Tvec;
begin
CreateIt(a);
try
a.SetIt(false,[1,2,3]);
a.Resize(7,True); // a= [1,2,3,0,0,0,0]
finally
FreeIt(a);
end;
end;
Declaration
Function Resize(Src: TMtxVec; Len: integer; ZeroIt: boolean = False): TVec;
Description
Resizes calling vector Length to Len and fills it with Src vector first Len values. If Src length is less than Len and ZeroIt parameter is true, the remaining calling vector values are set to zero.
Example 1
var a, b: Tvec;
begin
CreateIt(a,b);
try
a.SetIt(false,[1,2,3]);
b.SetIt(false,[9]);
b.Resize(a,7,True); // b=(9,1,2,3,4,0,0,0)
finally
FreeIt(a,b);
end;
end;
| Copyright 2008 Dew Research |
http://www.dewresearch.com