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/CAHnU2dYa%2BxOvf-3JG3k1A6wWSk4BDsNbAuJmc0bL_H4Ut2ZSAQ%40mail.gmail.com.

Reply via email to