[GAP Forum] Display of matrices

Benjamin Sambale bsambale at gmx.de
Fri Aug 19 19:12:16 BST 2011


Thank you, Ivo and Thomas!

Thomas's solution answers both of my questions, so I'm happy with it. 
However, in my opinion the behavior of "Display" is somehow strange, but 
anyway...

Best wishes,
Benjamin

Am 19.08.2011 19:23, schrieb Thomas Breuer:
> Dear GAP Forum,
>
> Benjamin Sambale wrote:
>
>> I have two related easy questions concerning the Display command for
>> matrices.
>>
>> The first one: I like the output of Display([[1,0],[0,1]]*Z(2)) much
>> more then the output of Display([[1,0],[0,1]]). Especially that dots
>> substitute zeros. However, I really want to work with integral
>> matrices and not matrices over finite fields. Is it possible to
>> change this behavior of "Display"?
>>
>> The second one: I also want to consider "large" matrices with say
>> 100 rows. Here I don't want that the Display command breaks lines.
>> Instead I want to scroll through the output. This is very useful in
>> order to recognize patterns. Since this question might also depend
>> on the operating system, I have to say that I use Arch Linux and
>> bash as shell. Increasing the COLUMNS variable doesn't change
>> anything. Any ideas?
> As for the second question,
> I would recommend the Browse package.
> The GAP code appended below can be used for scrolling through
> integer matrices, where each zero is shown as a dot.
>
> After loading the Browse package and reading the appended GAP code,
> you can enter the following.
>
>      m:= RandomMat( 100, 100 );;  # Create a matrix that exceeds the screen.
>      Browse( m );
>
> Then the topleft part of the matrix is shown on the screen,
> with row labels shown on the left and column labels shown at the top.
> Using the arrow keys (or the udlr keys) one can scroll by one row or column,
> using the UDLR keys one can scroll by one page.
> Enter ? for an overview of supported key strokes.
> One returns to the GAP prompt by entering Q.
>
> All the best,
> Thomas
>
> ----------------------------------------------------------------------------
>
> InstallMethod( Browse, [ IsTable ],
>      function( table )
>        local m, n, conv, r;
>
>        m:= Length( table );
>        n:= Maximum( List( table, Length ) );
>
>        conv:= function( entry )
>          if entry = 0 then
>            return ".";
>          else
>            return String( entry );
>          fi;
>        end;
>
>        r:= rec( work:= rec(
>          align:= "c",
>          main:= List( table, row ->  List( row, conv ) ),
>          labelsRow:= List( [ 1 .. m ], i ->  [ String( i ) ] ),
>          labelsCol:= [ List( [ 1 .. n ], String ) ],
>          sepLabelsCol:= [ "", "-" ],
>          sepLabelsRow:= [ "", " | " ],
>          ) );
>
>        NCurses.BrowseGeneric( r );
>      end );
>
>
>
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
>

  * Englisch - erkannt
  * Englisch
  * Deutsch

  * Englisch
  * Deutsch

<javascript:void(0);>



More information about the Forum mailing list