Re: [fricas-devel] Possible bug in Library domain for matrices

2021-04-23 Thread Waldek Hebisch
On Fri, Apr 23, 2021 at 12:02:55PM -0700, Tobias Neumann wrote:
> This seems like a bug in Library to me:
> 
> Failing to read back when somehow when there is a non-trivial kernel in the 
> matrix, like sqrt(x), or exp(x), etc..
> 
> matx1 := matrix([[0,sqrt(x1)],[0,0]]) :: Matrix(Expression(Integer))
> lib := library("mat.lib")
> lib.'matx1 := matx1;
> lib.'matx1
> 
> lib.'matx1
> 
>>> System error:
>illegal sharp macro character: #\<
> 
>   Line: 139465, Column: 32, File-Position: 13113927
> 
>   Stream: # {1003932393}>

Yes, there was rather general problem with arrays, needed code was
missing.  Should be fixed now in the trunk.

-- 
  Waldek Hebisch

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/20210424023722.GA39921%40math.uni.wroc.pl.


Re: [fricas-devel] Possible bug in Library domain for matrices

2021-04-23 Thread Tobias Neumann
Hi Ralf,

thanks, this is great. While this is not entirely what I am looking for in 
my specific case,
I was looking for such an output format before. (I read in a few MB large 
matrix expression
and wanted to check if saving and loading it from a Library would be 
faster).
In some cases I actually prefer an output format like Format1D over the 
default 2D.

As for the Library: I think it's useful anyhow to have such bugs 
collected/reported somewhere.

I've written a Mathematica interface to FriCAS a few days ago, and for that
I'm using unparse( stuff :: InputForm ) to return stuff to Mathematica. 
Your new
Format1D output format might actually be somewhat better for that (just as 
you do for jfricas).

Tobias

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/da50e75b-3a02-45cf-872c-60fafe774bc7n%40googlegroups.com.


Re: [fricas-devel] Possible bug in Library domain for matrices

2021-04-23 Thread Ralf Hemmecke
Hi Tobias,

I cannot help you with the Library domain, but perhaps the new Format1D
domain can help you. (See current github repo, you would have to compile
from the HEAD there.)

Format1D is not perfect, but I have created it in order to cut
output from FriCAS back to the input line. I would be happy if someone
tries it out and sends feedback.

Switching it on is a bit cumbersome, but not too hard.

)set output formatted on
F ==> Formatter
l := [F Format1D];
setFormats!(l pretend List(OutputFormatterCategory))$FormattedOutput

If you do not like algebra output together with Format1D, then switch it
off.

)set output algebra off


(1) -> )set output formatted on
(1) -> F ==> Formatter
Type: Void
(2) -> l := [F Format1D];
Type: List(Type)
(3) -> setFormats!(l pretend List(OutputFormatterCategory))$FormattedOutput
 Type: Void
(4) -> matx1 := matrix([[0,x1],[0,0]]) :: Matrix(Expression(Integer))

+0  x1+
   (4)  | |
+0  0 +
matrix[[0, x1], [0, 0]]

  Type: Matrix(Expression(Integer))
(5) -> matx2 := matrix([[0,sqrt(x1)],[0,0]]) :: Matrix(Expression(Integer))

++--++
   (5)  |0  \|x1 |
||
+00  +
matrix[[0, sqrt(x1)], [0, 0]]

 Type: Matrix(Expression(Integer))
(6) -> matrix[[0, sqrt(x1)], [0, 0]]

++--++
   (6)  |0  \|x1 |
||
+00  +
matrix[[0, sqrt(x1)], [0, 0]]

 Type: Matrix(Expression(Integer))



You could also do a few tricks with it as is done in JFriCASSupport

(9) -> setFormat!(Format1D)$JFriCASSupport
 Type: Void
(12) -> )set output algebra off
(12) -> matx1 := matrix([[0,x1],[0,0]]) :: Matrix(Expression(Integer))

--FORMAT:BEG:Format1D
matrix[[0, x1], [0, 0]]
--FORMAT:END:Format1D

 Type: Matrix(Expression(Integer))
(13) -> matx2 := matrix([[0,sqrt(x1)],[0,0]]) :: Matrix(Expression(Integer))

--FORMAT:BEG:Format1D
matrix[[0, sqrt(x1)], [0, 0]]
--FORMAT:END:Format1D
 Type: Matrix(Expression(Integer))

So you could parse the output easily by a script.
The strings between the --FORMAT:BEG ... --FORMAT:END should be readable
as if they come from a .input file.


Ralf

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/1bd76831-6afb-60b7-4df6-a59419d4516d%40hemmecke.org.


[fricas-devel] Possible bug in Library domain for matrices

2021-04-23 Thread Tobias Neumann
This seems like a bug in Library to me:

Working example:

matx1 := matrix([[0,x1],[0,0]]) :: Matrix(Expression(Integer))
lib := library("mat.lib")
lib.'matx1 := matx1;
lib.'matx1

Failing to read back when somehow when there is a non-trivial kernel in the 
matrix, like sqrt(x), or exp(x), etc..

matx1 := matrix([[0,sqrt(x1)],[0,0]]) :: Matrix(Expression(Integer))
lib := library("mat.lib")
lib.'matx1 := matx1;
lib.'matx1

lib.'matx1

   >> System error:
   illegal sharp macro character: #\<

  Line: 139465, Column: 32, File-Position: 13113927

  Stream: #

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/a452b05e-26d7-48b8-8f43-2460d36abe82n%40googlegroups.com.