@erik2727:
In principle, vector is just one-dimentional array. In Pascal there are static and dynamic arrays:
https://www.freepascal.org/docs-html/ref/refsu14.htmlImportantly, static array may be declated with any indexing you want:
type
TFortranArray = array[1..122] of float;
TColors = (Red,Green,Blue);
TColorArray = array[TColors] of byte;
but dynamic arrays are always 0-based.
In LMath,
TVector = array of Float;
TCompVector = array of Complex;
etc.
So, all T*Vector types in LMath are dynamic arrays, internally 0-based. When fortran-style functions of LMath use "1-based" arrays, they simply ignore first element, with index "0".
Call to system function SetLength(V,10) allocates dynamic array with 10 elements, indexed from V[0] to V[9]. If we think "fortran-style", we would expect highest index 10. Therefore, LMath defines own wrapper function DimVector, where not length, but highest index of an array is passed: DimVector(V,10) allocates V[0] to V[10].
And yes, DimVector and SetLength resize an allocated array and copy all existing values into new array, of cource truncating if needed.