> < ^ Date: Fri, 21 Apr 1995 15:17:00 -0500
< ^ From: Walter Carlip <c3ar@math.uchicago.edu >
> ^ Subject: Loop Efficiency

Here's another naive beginner question . . .

I have a problem which requires checking (something) for every
element of a vector space. The code . . .

for v in Elements(RowSpace(field,generators)) do
(something)

works fine *except* it requires building a list of all elements
of the vector space first. (When the field or dimension is moderately
large, there is insufficent space to save the entire list.)

I tried instead several ways to iterate elements of the vector space
for example

```for a in field
for b in field
for c in field
for d in field
v = [a,b,c,d];
(something)
od;
od;
od;
od;
```

or

for i in [1..Size(field)^dimension] do
v := fieldelement(i)
(something)
od;

where "fieldelement" turned i into a vector like
[1,2,2,5] and produced the vector consisting of the
first, second, second and fifth field elements.

None of my attempts have been very satisfactory. I tested things
using a six-dimensional field over GF(7). Gap was barely able
store the elemetns of the field and (something) took about 12 seconds
to run on all vectors. With every iteration method I could think
of, Gap took considerably more than 2 minutes to run through the
list of vectors.

My question: Is there a quick way to iterate the elements of
a vector space or to ask Gap for the elements without gap having
to compute them all first?

Thanks,

```--Walter
_____________________________________________________________________________
Walter C3arlip                          **** carlip@ace.cs.ohiou.edu ****
(the "3" is silent)                     **** c3ar@zaphod.uchicago.edu ****
_____________________________________________________________________________
```

> < [top]