Purpose
Get the size of
an array, set, list, constraint or string.
Synopsis
function getsize(a:array):integer
function getsize(s:set):integer
function getsize(l:list):integer
function getsize(t:string):integer
function getsize(c:linctr):integer
Arguments
a
|
An array
|
s
|
A set
|
l
|
A list
|
t
|
A string
|
c
|
A linear constraint
|
Return value
Number of effective entries for an array, number of elements for a set or a list, number of characters for a string, number
of terms for a constraint.
Example
In the following, a dynamic array is declared holding eight elements, of which only two are actually defined. Calling getsize on this array returns 2 rather than 8. The length lw of the string w is 9.
declarations
a:dynamic array(1..8) of real
w = "some text"
end-declarations
a(1):= 4
a(5):= 7.2
la:= getsize(a)
lw:= getsize(w)
Further information
In the
case of a dynamic array that has been declared with a maximal range
this number may be smaller than the size of the range, but it cannot
exceed it. When used with a string, this function returns the length
of the string (i.e. the number of characters it contains).
If used with a linear constraint, this function returns the number
of terms of the constraint (the constant term is not taken into
account).
If you have any comments or suggestions about these pages,
please send mail to docs@dashoptimization.com.