TVecSmallInt.Ramp Method

Overload List

#SignatureDescription
1function Ramp: TVecInt;Fills the calling vector with a series following linear rule.
2function Ramp(Offset: Double; Step: Double): TVecInt;Fills the calling vector.
└ indexed: function Ramp(Offset: Double; Step: Double; Index: Integer; Len: Integer): TMtxVecInt;

Overload 1: function Ramp: TVecInt;

Fills the calling vector with a series following linear rule.

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

Remarks:

Fills the calling vector with a series following the rule:

Values[k] :=  k

(Offset is zero and Step is one).

Examples
var a: TVec;
begin
    CreateIt(a);
    try
        a.Size(5,True);
        a.Ramp(0,Pi);
        a.Sin;
    finally
        FreeIt(a);
    end;
end;
CreateIt(a);
try
    a.Size(5,True);
    for i:= 0 to a.Length-1 do a[i] := sin(i*Pi);
finally
    FreeIt(a);
end;

Overload 2: function Ramp(Offset: Double; Step: Double): TVecInt;

Fills the calling vector.

#NameTypeDescription
1OffsetDoublescalar
2StepDoublescalar

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

Remarks:

Method uses the following rule:

Values[k] := Offset + k*Step.
Examples
CValues[k] := Offset + k*Step.

Indexed: function Ramp(Offset: Double; Step: Double; Index: Integer; Len: Integer): TMtxVecInt;

Fills the calling vector elements [Index]..[Index+Len-1].

#NameTypeDescription
1OffsetDoublescalar
2StepDoublescalar
3IndexIntegerstart index
4LenIntegerelement count

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

Remarks:

Method uses the following rule:

Values[k] := Offset + k*Step.

An exception is raised if calling vector array borders are overrun.

Examples
Values[k] := Offset + k*Step.