Thank you for the Flint reference, I will check it out, and thanks again
for your hard work debugging!

Best,

Håkan

On Mon, May 6, 2024 at 9:57 AM Vincent Delecroix <20100.delecr...@gmail.com>
wrote:

> The fix was easy. Much harder was to find the root of the problem!
>
> If you are interested in intensive computations over QQbar I strongly
> advise you to look towards https://flintlib.org/ maintained by Fredrik
> Johansson. This library has *two* implementations of QQbar which are
> way more performant (and probably more reliable) than what is in
> SageMath. The more or less short term goal is to use flint
> implementations to replace the current QQbar implementation in
> SageMath.You could give it a try inside SageMath via
> https://github.com/mezzarobba/flint_gr_sage (feel free to open an
> issue there asking for installation help or describing the things you
> want to compute).
>
> I do intend to make my commit part of SageMath QQbar, but it is not on
> the top priority list.
>
> Best
> Vincent
>
> On Mon, 6 May 2024 at 09:27, Hakan Granath <hakan.gran...@gmail.com>
> wrote:
> >
> > Great, thanks for working out and fixing the (quite non-trivial, it
> seems) root cause of this issue!
> >
> > Just a curious question: would it be useful to add the functionality of
> your commit 8de6ba5 to potentially simplify QQbar objects? Especially doing
> linear algebra over QQbar I guess you get many trivial operations (like
> adding 0) and optimizing them away might maybe improve performance? Just an
> idea, I haven't done any benchmarking to support that hypothesis.
> >
> > Best regards,
> >
> > Håkan
> >
> > On Mon, May 6, 2024 at 12:15 AM Vincent Delecroix <
> 20100.delecr...@gmail.com> wrote:
> >>
> >> Turns out to be a serious bug in complex interval fields. The problem
> >> is hopefully fixed by https://github.com/sagemath/sage/pull/37941
> >> which should make its way to the next sage release.
> >>
> >> Thanks again for your report.
> >> Vincent
> >>
> >> On Fri, 3 May 2024 at 18:13, vdelecroix <20100.delecr...@gmail.com>
> wrote:
> >> >
> >> > Thanks for your report! I simplified a bit your example and posted an
> issue https://github.com/sagemath/sage/issues/37927.
> >> >
> >> > Vincent
> >> >
> >> > Le vendredi 3 mai 2024 à 15:05:03 UTC+2, Hakan Granath a écrit :
> >> >>
> >> >> Hi,
> >> >>
> >> >> I think sometimes matrices over QQbar give erroneous results (sorry
> for the messy example, if I try to simplify it the problem disappears):
> >> >>
> >> >> R.<y> = QQ[]
> >> >> v1 = QQbar.polynomial_root(AA.common_polynomial(y^2 + 1),
> CIF(RIF(RR(0)), RIF(-RR(1))))
> >> >> v2 = QQbar.polynomial_root(AA.common_polynomial(y^2 + 1),
> CIF(RIF(RR(0)), RIF(RR(1))))
> >> >> v3 = 4*v2
> >> >> v4 = AA.polynomial_root(AA.common_polynomial(y^2 - 2),
> RIF(-RR(1.4142135623730951), -RR(1.4142135623730949)))
> >> >> v5 = AA.polynomial_root(AA.common_polynomial(y^2 - 2),
> RIF(RR(1.4142135623730949), RR(1.4142135623730951)))
> >> >> v6 = QQbar.polynomial_root(AA.common_polynomial(y^2 + 16),
> CIF(RIF(RR(0)), RIF(-RR(4))))
> >> >> v7 = v6*v6
> >> >> v8 = QQbar.polynomial_root(AA.common_polynomial(y^2 + 1),
> CIF(RIF(RR(0)), RIF(RR(1))))
> >> >>
> >> >> M = matrix(QQbar, [[0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0,
> 0, 0, 0, 0, 0], [-4, 2*v1, 1, 64, -32*v1, -16, 8*v1, 4, -2*v1, -1], [4*v1,
> 1, 0, -192*v1, -80, 32*v1, 12, -4*v1, -1, 0], [2, 0, 0, -480, 160*v1, 48,
> -12*v1, -2, 0, 0], [-4, 2*v2, 1, 64, -32*v2, -16, 8*v2, 4, -2*v2, -1], [v3,
> 1, 0, -192*v2, -80, 32*v2, 12, -v3, -1, 0], [2, 0, 0, -480, 160*v2, 48,
> -12*v2, -2, 0, 0], [0, 0, 0, 8, QQbar(4*v4), 4, QQbar(2*v4), 2,
> QQbar(AA.polynomial_root(AA.common_polynomial(y^2 - 2),
> RIF(-RR(1.4142135623730951), -RR(1.4142135623730949)))), 1], [0, 0, 0,
> QQbar(24*v4), 20, QQbar(8*v4), 6, QQbar(2*v4), 1, 0], [0, 0, 0, 8,
> QQbar(4*v5), 4, QQbar(2*v5), 2,
> QQbar(AA.polynomial_root(AA.common_polynomial(y^2 - 2),
> RIF(RR(1.4142135623730949), RR(1.4142135623730951)))), 1], [0, 0, 0,
> QQbar(24*v5), 20, QQbar(8*v5), 6, QQbar(2*v5), 1, 0], [0, 0, 0, v7*v7*v7,
> v7*v7*v6, v7*v7, v6*v6*v6, v6*v6, v6, 1], [0, 0, 0, -4096, 1024*v8, 256,
> -64*v8, -16, 4*v8, 1]])
> >> >>
> >> >> With this matrix I get:
> >> >>
> >> >>   sage: M.right_kernel_matrix()
> >> >>   []
> >> >>
> >> >> but in fact the right kernel is generated by:
> >> >>
> >> >>   sage: v = Matrix(QQbar, 10, 1, [-108, 0, 0, 1, 0, 12, 0, -60, 0,
> 64])
> >> >>   sage: M * v == 0
> >> >>   True
> >> >>
> >> >> This is with SageMath version 10.3 using Python 3.11.1 on Ubuntu
> 22.04.4.
> >> >>
> >> >> Best regards,
> >> >>
> >> >> Håkan Granath
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google
> Groups "sage-devel" group.
> >> > To unsubscribe from this group and stop receiving emails from it,
> send an email to sage-devel+unsubscr...@googlegroups.com.
> >> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/1c927686-bada-4943-8000-a6fdf6e71029n%40googlegroups.com
> .
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups "sage-devel" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an email to sage-devel+unsubscr...@googlegroups.com.
> >> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/CAGEwAAkgsAcFmt-6NKWvuh0va_UVy-jdSJVnPrSrjGE_CA3Nog%40mail.gmail.com
> .
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "sage-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to sage-devel+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/CAOnrL6%2BO0s%3D6poKYFo17xTLrrX4SdCFuj%2BQj7tpkjtQfL%2BvQNw%40mail.gmail.com
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/CAGEwAAnudV9KV1daN%3DY5YCC3btCf7%3D%3D9hc9rRTmuX0Ck%2BRs8ww%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAOnrL6KYrgAt3D5OqMw8%3DRbp2zQMSqCZ0upFT14wbK5pHc8Whw%40mail.gmail.com.

Reply via email to