Testing latest pari + WASM + node.js... and it works?! Wow.
License: GPL3
ubuntu2004
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
box given by $v$ with unit steps: $X$ is an $n$-dimensional vector whose $i$-th
entry $X[i]$ runs through $a_i, a_i+1, a_i+2, \dots $ stopping with the
first value greater than $b_i$ (note that neither $a_i$ nor $b_i - a_i$
are required to be integers). The values of $X$ are ordered
lexicographically, like embedded \kbd{for} loops, and the expression
\var{seq} is evaluated with the successive values of $X$. The type of $X$ is
the same as the type of $v$: \typ{VEC} or \typ{COL}.
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