Yes, thanks. As a workaround, it seems possible to save the matrix as an integer matrix and then read it back and assign it to a matrix of type PAdicRational.
SWA On Saturday, April 15, 2023 at 10:41:18 AM UTC-5 [email protected] wrote: > Look at > > https://fricas.github.io/api/PAdicRational.html > > PAdicRational is build on InnerPAdicInteger. And that in turn is > implemented as Stream(Integer). > > https://github.com/fricas/fricas/blob/master/src/algebra/padic.spad#L77 > > So, in generaal, FriCAS has to save and read a stream. While this is not > completely impossible (because a stream is also in memory just described > with a finite amount of data), the way it is done via your write!(f,A) > cannot work, since that does obviously only write out the first few > values of the stream. In fact, "NullStream" is a special way to denote > "the end of the stream". Unfortunately, FriCAS doesn't seem to handle > this case well when reading your file. > > Since some streams are finite, the situation could be cured for them, > but what would it help? Potentially, streams are infinity and to do it > properly, the file should contain exactly the data that produces the > stream, i.e., the first few values together with a PROGRAM that computes > any following value. > > Does that explain the problem? > > Ralf > > On 15.04.23 17:18, Sid Andal wrote: > > A matrix of type PAdicRational is defined and saved in a file. However, > > attempting to read it back leads to an error: > > > > PR ==> PAdicRational(13) > > SQ ==> SQMATRIX(4, PR) > > > > A : SQ := [[2, 3, 5, 0], [7, 11, 12, 4], [3, 8, 6, 10], [12, 9, 8, 5]] > > > > typeOf A > > > > SquareMatrix(4,PAdicRational(13)) > > > > f : File SQ := open("PaMat4x4.out", "output") > > > > write!(f,A) > > close!(f) > > > > > > $ cat PaMat4x4.out > > > > #2A(((0 2 #1="NullStream") (0 3 #1#) (0 5 #1#) (0 #1#)) > > ((0 7 #1#) (0 11 #1#) (0 12 #1#) (0 4 #1#)) > > ((0 3 #1#) (0 8 #1#) (0 6 #1#) (0 10 #1#)) > > ((0 12 #1#) (0 9 #1#) (0 8 #1#) (0 5 #1#))) > > > > > > $ cp PaMat4x4.out PaMat4x4.input > > > > > > fn := filename("", "PaMat4x4", "input")$FileName > > > > f := open(fn, "input")$File(SQ) > > > > B : SQ := read!(f) > > > >>> System error: > > The value "NullStream" is not of type INTEGER. > > > > Removing the string "NullStream" doesn't seem to help....it leads to > > other types of errors. > > > > Thanks, > > SWA > > > -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/09b47db0-b221-4edb-b69a-56121f16f323n%40googlegroups.com.
