As a matter of fact, use of FLINT in FriCAS:

(16) -> p:=(2*x+2*x^5+13*x^9)::UP("x",INT)

             9      5
   (16)  13 x  + 2 x  + 2 x
                                        Type:
UnivariatePolynomial(x,Integer)
                                                                  Time: 0
sec
(17) -> p:=p^5;

                                        Type:
UnivariatePolynomial(x,Integer)
                                                                  Time: 0
sec
(18) -> degree(p^750)

   (18)  33750
                                                        Type:
PositiveInteger
                                     Time: 28.17 (EV) + 3.17 (GC) = 31.34
sec
(19) -> degree(p^750)

   (19)  33750
                                                        Type:
PositiveInteger
                         Time: 0.02 (IN) + 31.17 (EV) + 3.06 (GC) = 34.25
sec
(20) -> degree(p^750)

   (20)  33750
                                                        Type:
PositiveInteger
                                     Time: 29.72 (EV) + 2.93 (GC) = 32.65
sec
(21) -> )cl prop p
(21) -> x:=x::NUP(NINT,"x")

   (21)  x
                                Type:
NemoUnivariatePolynomial(NemoInteger,x)
                                                                  Time: 0
sec
(22) -> p:=2*x+2*x^5+13*x^9

   (22)  13*x^9 + 2*x^5 + 2*x
                                Type:
NemoUnivariatePolynomial(NemoInteger,x)
                                                                  Time: 0
sec
(23) -> p:=p^5;

                                Type:
NemoUnivariatePolynomial(NemoInteger,x)
                                                                  Time: 0
sec
(24) -> degree(p^750)

   (24)  33750
                                                        Type:
PositiveInteger
                                                   Time: 0.09 (EV) = 0.09
sec
(25) -> degree(p^750)

   (25)  33750
                                                        Type:
PositiveInteger
                                                   Time: 0.06 (EV) = 0.06
sec
(26) -> degree(p^750)

   (26)  33750
                                                        Type:
PositiveInteger
                                                   Time: 0.07 (EV) = 0.07
sec

Of course, different aims for FriCAS and Nemo/FLINT in Julia, even if now
Python and Julia allow a more object oriented utilisation.

If you have Julia in your path, and Nemo installed in it and you want to
give it a try, a simple:
git clone -b jlfricas --depth=1 https://github.com/gvanuxem/fricas.git

will  fetch the source. With sbcl just a './configure --enable-julia'
should do the trick.
DISCLAIMER: draft code.

- Greg




Le sam. 4 mai 2024 à 07:35, Grégory Vanuxem <g.vanu...@gmail.com> a écrit :

> The first part of the mail about the use of devaluate is because, here,
> when constructing a matrix I need a _very_ specialized matrix type,
> FLINT[1] will be used so I can not use the generic Matrix type. As an
> illustration I use this later in this domain:
>
> "devaluate" use is to define function(s), here the matrix constructor, in
> a specialized Matrix ring, so later with the Ring name as a string I can do:
>
> else if NRing = "NemoPrimeField" and R has FiniteFieldCategory then
>   new(rows, cols, a) ==
>     jlref(concat(["matrix_space(GF(", string(size()$R), "),", string(rows),
> ",",
>       string(cols),")(fill(", getind(a), ",(",
>         string(rows), ",", string(cols),")))"]))
> else if NRing is "NemoIntegerMod" and R has Finite then
>   new(rows, cols, a) ==
>     jlref(concat(["matrix_space(residue_ring(ZZ,", string(size()$R), "
> )[1]),", string(rows), ",",
>       string(cols),")(fill(", getind(a), ",(",
>         string(rows), ",", string(cols),")))"]))
>         else if NRing = "NemoRealBall" and R has JuliaArbitraryPrecision
> then
>           new(rows, cols, a) ==
>             jlref(concat(["matrix_space(ArbField", string(precision()$R),
> "),", string(rows), ",",
>               string(cols),")(fill(", getind(a), ",(",
>                 string(rows), ",", string(cols),")))"]))
>
> "has Finite" or "has FiniteFieldCategory" let me call size() . And yes
> that is not beautiful code, the use of concatenated strings for
> constructions.
>
> Not very easy to explain, I admit.
>
> [1] https://flintlib.org/
>
>
>
> Le sam. 4 mai 2024 à 07:05, Qian Yun <oldk1...@gmail.com> a écrit :
>
>>
>>
>> On 5/4/24 12:43, Grégory Vanuxem wrote:
>> > Hello,
>> >
>> > I have found 'devaluate' in some Spad files and it can be handy. Some
>> > domains are parameterized and it is not possible, or at least I don't
>> > know how to do it, to use ' is ' instead of ' has ' (Domain vs.
>> > Category) for them:
>> >
>> > if R is Foo then
>> >      new(n) == bar(n)
>> > else
>> >     new...
>> >
>> > it is not possible to use:
>> > if Foo(p) then
>> >
>> > Or like #1 in "SubDomain(Integer, #1 >= 0)" used for NonNegativeInteger?
>>
>> I'm not sure I understand your problem 100%, are you looking for
>> something like PrimeField in ffdoms.spad?
>>
>>      if not prime?(p)$IntegerPrimesPackage(Integer) then
>>
>>
>> Also it's difficult to know your problem with 'devaluate' in your
>> code snippet. Is there a minimal reproducible example?
>>
>> - Qian
>>
>> --
>> 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/81462d8e-17a9-4d2f-8589-e3b76c049f39%40gmail.com
>> .
>>
>

-- 
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/CAHnU2da1rnRLCG1%3DM21gUidk-wNDVMZk6iO8DLGgvJ3JJqXygA%40mail.gmail.com.

Reply via email to