Hello, Le sam. 11 mai 2024 à 21:25, Waldek Hebisch <de...@fricas.org> a écrit : > > On Sat, May 04, 2024 at 09:30:51AM +0200, Grégory Vanuxem wrote: > > As a matter of fact, use of FLINT in FriCAS: > > > > (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 > > Hmm, I wonder what you are computing here. Could you give result > (time and resulting number) for > > reduce(_+, map(length, coefficients(p^750))) > > assuming that 'length' and 'coefficients' are available for Nemo > integeres/polynomials. Also, I wonder if you can monitor actual CPU time > for this computation. I mean, if computation is delegated to a separate > process then FriCAS will not know about time spent in another process > and just report interface time. And one can split such computation > into multiple cores, that reduces real time (if you have enough > cores).
Looking more carefully. I have not implemented coefficients since coefficients in Nemo/AbstractAlgebra returns an iterator. But if you want a "list" as in LISP you can use collect on this iterator. The problem is that polynomial of degree, say 9, will return all coefficients;: julia> p 13*x^9 + 2*x^5 + 2*x julia> collect(coefs) 10-element Vector{ZZRingElem}: 0 2 0 0 0 2 0 0 0 13 So in principle, in FriCAS, the default 'coefficients' operation is used: (8) -> coefficients(p) (8) [13, 2, 2] Type: List(NemoInteger) But I have also not implemented length for NemoInteger since Nemo does not have it unless doing low level stuff I guess (it's a GMP mpz_t as far as I know), so for your question (not first powered): (6) -> p (6) 13*x^9 + 2*x^5 + 2*x Type: NemoUnivariatePolynomial(NemoInteger,x) Time: 0 sec (7) -> pp 9 5 (7) 13 y + 2 y + 2 y Type: UnivariatePolynomial(y,Integer) Time: 0 sec (8) -> reduce(_+,map(length, coefficients(p^750)::List(INT))) (8) 3672690 Type: PositiveInteger Time: 0.30 (IN) + 1.47 (EV) = 1.78 sec (9) -> reduce(_+,map(length, coefficients(pp^750)::List(INT))) (9) 3672690 Type: PositiveInteger Time: 0.20 (EV) + 0.01 (GC) = 0.22 sec What you're asking is too costly for my actual implementation. I should not have used the word "arithmetic" this morning, my mistake, sorry, what I meant is that I have not implemented all _primitive_routines, all polynomial manipulation/information routines. With p^5^750, and the different coercions, FriCAS silently stop and the process returns to the bash shell :-( And for your question about the number of threads used the Nemo documentation says: ----------------------------------------------------- Experimental threading support for flint Enabling a threaded version of flint can be done by setting the environment variable NEMO_THREADED=1. To set the actual number of threads, use Nemo.flint_set_num_threads($numberofthreads). If you need more information, please let me know. ----------------------------------------------------- https://nemocas.github.io/Nemo.jl/latest/#Experimental-threading-support-for-flint Using it: -- Execute a julia command directly in FriCAS and displa its returned value (11) -> )jud Nemo.flint_set_num_threads(1) To use threaded flint, julia has to be started with NEMO_THREADED=1 (11) -> And time given by FriCAS seems good, that's extremely fast. - Greg -- 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/CAHnU2dbP6wF2w88JvQHmDRrbYDBxtfFTn1okym8Hu2rQYUhGyA%40mail.gmail.com.