Function: _forvec_init
Class: gp2c_internal
Help: Initializes parameters for forvec.
Description:
(forvec, gen, ?small):void forvec_init(&$1, $2, $3)
Function: _forvec_next
Class: gp2c_internal
Help: Initializes parameters for forvec.
Description:
(forvec):vec forvec_next(&$1)
Function: forvec
Section: programming/control
C-Name: forvec
Prototype: vV=GID0,L,
Iterator: (gen,gen,?small) (forvec, _forvec_init, _forvec_next)
Help: forvec(X=v,seq,{flag=0}): v being a vector of two-component vectors of
length n, the sequence is evaluated with X[i] going from v[i][1] to v[i][2]
for i=n,..,1 if flag is zero or omitted. If flag = 1 (resp. flag = 2),
restrict to increasing (resp. strictly increasing) sequences.
Doc: Let $v$ be an $n$-component
vector (where $n$ is arbitrary) of two-component vectors $[a_i,b_i]$
for $1\le i\le n$, where all entries $a_i$, $b_i$ are real numbers.
This routine lets $X$ vary over the $n$-dimensional hyperrectangle
given by $v$, that is, $X$ is an $n$-dimensional vector taking
successively its entries $X[i]$ in the range $[a_i,b_i]$ with lexicographic
ordering. (The component with the highest index moves the fastest.)
The type of $X$ is the same as the type of $v$: \typ{VEC} or \typ{COL}.
The expression \var{seq} is evaluated with the successive values of $X$.
If $\fl=1$, generate only nondecreasing vectors $X$, and
if $\fl=2$, generate only strictly increasing vectors $X$.
\bprog
? forvec (X=[[0,1],[-1,1]], print(X));
[0, -1]
[0, 0]
[0, 1]
[1, -1]
[1, 0]
[1, 1]
? forvec (X=[[0,1],[-1,1]], print(X), 1);
[0, 0]
[0, 1]
[1, 1]
? forvec (X=[[0,1],[-1,1]], print(X), 2)
[0, 1]
@eprog