Problem with writelist and list of matrices
Ravi · Sat Sep 12, 2009 8:55 am
I have a problem using the writelist function when I write a list of matrices to a file and want to recreate the list in memory by reading the file later on. Here is a simple example:
This creates the text file alright:
list simplist;
simplist[1]=matrix(
0,1,0,-1,0,0,0,0,1);
etc...
but when I try to read it and recreate simplist:
The error I get is:
According to the help files (D.2.4.9), this should create the object simplist. It works for other objects, but not for lists of matrices.
If someone can tell me what is going wrong, I shall be most grateful...
Ravi
Code:
ring R = 0, (x,y,z), dp;
matrix A[3][3] = 0,1,0, -1,0,0, 0,0,1;
matrix B[3][3] = 0,1,0, 0,0,1, 1,0,0;
matrix C[3][3] = 0,1,0, 1,0,0, 0,0,1;
list L = A,B,C;
writelist("simple-write.txt", "simplist", L);
matrix A[3][3] = 0,1,0, -1,0,0, 0,0,1;
matrix B[3][3] = 0,1,0, 0,0,1, 1,0,0;
matrix C[3][3] = 0,1,0, 1,0,0, 0,0,1;
list L = A,B,C;
writelist("simple-write.txt", "simplist", L);
This creates the text file alright:
list simplist;
simplist[1]=matrix(
0,1,0,-1,0,0,0,0,1);
etc...
but when I try to read it and recreate simplist:
Code:
ring R = 0, (x,y,z), dp;
execute(read("simple-write.txt")); // does not create the list simplist in memory
execute(read("simple-write.txt")); // does not create the list simplist in memory
The error I get is:
Code:
? error occurred in Read-Oh.sing line 10: `0,1,0,-1,0,0,0,0,1);`
? wrong type declaration. type 'help matrix;'
? last reserved name was `matrix`
skipping text from `-` error at token `)`
? wrong type declaration. type 'help matrix;'
? last reserved name was `matrix`
skipping text from `-` error at token `)`
According to the help files (D.2.4.9), this should create the object simplist. It works for other objects, but not for lists of matrices.
If someone can tell me what is going wrong, I shall be most grateful...
Ravi