> < ^ Date: Fri, 27 Jul 2001 14:16:04 +0100
> < ^ From: Steve Linton <sal@dcs.st-and.ac.uk >
> < ^ Subject: Re: GUAVA 1.4

Dear GAP Forum,

Stas Bulygin asked about displaying a generator matrix produced from GUAVA in
a more explicit form than:

[ <an immutable GF2 vector of length 7>, <an immutable GF2 vector of length
7>
, <an immutable GF2 vector of length 7>,
<an immutable GF2 vector of length 7> ]

To understand what is happening here you need to understand the meaning and
purpose of three GAP operations: View, Print and Display, which are described
in full in chapter 6.2 of the manual.

I quote:

* View( obj1, obj2... ) F 

View shows the objects obj1, obj2... etc. in a short form on the standard
output. View is called in the read--eval--print loop, thus the output looks
exactly like the representation of the objects shown by the main loop. Note
that no space or newline is printed between the objects.

*  Print( obj1, obj2... ) F 

Also Print shows the objects obj1, obj2... etc. on the standard output. The
difference compared to View is in general that the shown form is not required
to be short, and that in many cases the form shown by Print is GAP readable.

*  Display( obj ) O 

Displays the object obj in a nice, formatted way which is easy to read (but
might be difficult for machines to understand). The actual format used for
this depends on the type of obj.

So, the problem that Stas has is that the main loop View's the result of a
computation, and, in this case, the short form is not what he needs. The
solution is to store the result in a variable (don't worry if you forget, it
will be stored temporarily in the variable `last') and the Print or Display
it. For even tidier results, one can use ;; to suppress the automatic View.

gap> m :=  GeneratorMat(HammingCode(3,GF(2)));; Display(m)
 1 1 1 . . . .
 1 . . 1 1 . .
 . 1 . 1 . 1 .
 1 1 . 1 . . 1
gap> m :=  GeneratorMat(HammingCode(3,GF(2)));; Print(m,"\n");
[ [ Z(2)^0, Z(2)^0, Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
  [ Z(2)^0, 0*Z(2), 0*Z(2), Z(2)^0, Z(2)^0, 0*Z(2), 0*Z(2) ], 
  [ 0*Z(2), Z(2)^0, 0*Z(2), Z(2)^0, 0*Z(2), Z(2)^0, 0*Z(2) ], 
  [ Z(2)^0, Z(2)^0, 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2), Z(2)^0 ] ]

Steve Linton


> < [top]