-
Notifications
You must be signed in to change notification settings - Fork 175
Open
Labels
gapdays2022-summerIssues and PRs that arose at https://www.gapdays.de/gapdays2022-summerIssues and PRs that arose at https://www.gapdays.de/gapdays2022-summer
Description
We have them (or some of them) in lib/matobj.gi, starting around line 1393:
BindGlobal( "ViewStringForVectorObj",
v -> Concatenation( "<vector object of length ", String( Length( v ) ),
" over ", String( BaseDomain( v ) ), ">" ) );
InstallMethod( ViewString,
[ IsVectorObj ],
ViewStringForVectorObj );
InstallMethod( DisplayString,
[ IsVectorObj ],
ViewStringForVectorObj );
InstallMethod( String,
[ IsVectorObj ],
v -> Concatenation( "NewVector( ",
NameFunction( ConstructingFilter( v ) ), ", ",
String( BaseDomain( v ) ), ", ",
String( Unpack( v ) ), " )" ) );
BindGlobal( "ViewStringForMatrixObj",
M -> Concatenation( "<matrix object of dimensions ",
String( NumberRows( M ) ), "x", String( NumberColumns( M ) ),
" over ", String( BaseDomain( M ) ), ">" ) );
InstallMethod( ViewString,
[ IsMatrixOrMatrixObj ],
ViewStringForMatrixObj );
InstallMethod( DisplayString,
[ IsMatrixOrMatrixObj ],
ViewStringForMatrixObj );
InstallMethod( String,
[ IsMatrixObj ],
M -> Concatenation( "NewMatrix( ",
NameFunction( ConstructingFilter( M ) ), ", ",
String( BaseDomain( M ) ), ", ",
String( NumberColumns( M ) ), ", ",
String( Unpack( M ) ), " )" ) );Some thoughts:
- these don't print any elements. I think it would be nice to be able to see the elements in the matrices, too. At least for
Printand forDisplay. Perhaps it is OK ifViewObjonly shows the current output, so that casually typing a matrix does not spam things... Dunnp Printis meant to output code which can be read in back; I am not sure whether we can do that in general, but if we want to try it, it could start with something likeNewMatrix(FILTER, BASEDOMAIN, MAT)whereMATis the result ofUnpackfor the original matrixViewObjand/orDisplaycould replace zeros by.and generally produce something more for humans, e.g.
gap> some_matobj;
A 2x3 matrix over GF(5):
. 1 3
3 . 2
- Julia has a nice feature were matrices are printed with elements; but if the number of rows and/or columns is too large, then it hides some rows/columns, and replaces them by some characters indicating this ... like in
[1 2 ... 999 1000]or even using Unicode, e.g.[ 1 2 ⋯ 999 1000 ]
Metadata
Metadata
Assignees
Labels
gapdays2022-summerIssues and PRs that arose at https://www.gapdays.de/gapdays2022-summerIssues and PRs that arose at https://www.gapdays.de/gapdays2022-summer