> < ^ Date: Thu, 30 Nov 1995 12:40:39 +0100
> ^ From: Andreas Hoppe <hoppe@math.tu-berlin.de >
< ^ Subject: Re: Input to GAP

Dear GAP-Forum,

Stefan Neis quoted:

> (In fact, the following problem occured while using "KASH", but since
> they use the "GAP-engine", I tought, this would be the right adress to
> ask...):
You're wrong with that one because, although KASH is using the GAP
parser, interpreter, basics types, it supplies its own types which follow
a slightly different concepts due to the fact that the major part of
KANT/KASH is written low-language (in C) in contrast to GAP where most
algorithms are implemented in high-language (GAP interpreter).

Although there's no such thing as a KASH-Forum You can post problems
like that to kant@math.tu-berlin.de .

To Your problem:
There are two things to distinguish: GAP matrices (list of lists) and
KANT matrices:

kash> M:=[[1,2],[3,4]];
[ [ 1, 2 ], [ 3, 4 ] ]
kash> TYPE(M);
"list"
kash> A:=Mat(Z,M);
[1 2]
[3 4]

kash> TYPE(A);
"KANT matrix"

The printout of most of the KASH types is not rereadable and only
printed for information. But for KANT matrices over Z You can use the
function MatToRowList() which is quite the opposite to Mat(*,.).

To get what You really want Alexander's function looks like that:

SaveKantMatZTo:=function(file,mat,name)
PrintTo(file,name,":=Mat(Z,",
MatToRowList(mat),");\n",
"Print(\"#I ",name," loaded\\n\");\n");
end;

kash> SaveKantMatZTo("mat1.kash",A,"B");
kash> Read("mat1.kash");
#I  B loaded
kash> B;
[1 2]
[3 4]

The latest release of KASH features a new BagWrite/BagRead
concept addressing exactly this problem in a more general
approach. See Manual for details.

Cheers
Andreas Hoppe

P.S.
KASH is a tool for sophisticated computations
in number fields and is availabe free of charge from
ftp.math.tu-berlin.de
User: ftp
Directory: /pub/algebra/Kant/Kash


> < [top]