FWIW, upgrading to 9.5.rc4 *and disabling the use of system’s pari and 
singular* gives the same symptoms. Possible suspect :

charpent@zen-book-flip:~$ sage -pip list | grep pari
cypari2                       2.1.2

I’m way out of my depth here…

HTH,
​
Le samedi 29 janvier 2022 à 22:51:14 UTC+1, Emmanuel Charpentier a écrit :

> The promlem seems tolie wit (my use of) polynomial rings to compute the 
> eigenvectors. Manually, after executing
>
> dims = M.dimensions()
> if dims[0] != dims[1]: raise DomainError("Not a square matrix !")
> dim = dims[0]
> BR = M.base_ring()
> try:
>     WR = BR.algebraic_closure()
> except AttributeError:
>     WR = BR
> WPR = WR["t"]
> t = WPR.gens()[0]
> # CP = WPR(M.charpoly(var="t"))
> # Eigenvalues
> CP = M.charpoly(var="t")
> lambdas = CP.roots(ring=WR)
> # Eigenvectors
> Id = identity_matrix(WR,dim)
> WM = M.apply_map(lambda u:WR(u))
> PR = PolynomialRing(WR,list(("v%d"%u for u in range(dim))))
> J=PR.ideal(*(WM-Id*lambdas[0][0])*vector(PR.gens()))
>
> neither J.dimension() nor J.variety() returns ; the interruption gives :
>
> sage: J.dimension()
>   C-c 
> C-c---------------------------------------------------------------------------
> KeyboardInterrupt                         Traceback (most recent call last)
> <ipython-input-684-2e62bddf16b7> in <module>
> ----> 1 J.dimension()
>
> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/polynomial/multi_polynomial_ideal.py
>  in __call__(self, *args, **kwds)
>     295         if not R.base_ring().is_field():
>     296             raise ValueError("Coefficient ring must be a field for 
> function '%s'."%(self.f.__name__))
> --> 297         return self.f(self._instance, *args, **kwds)
>     298 
>     299 require_field = RequireField
>
> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar_decorators.py
>  in wrapper(*args, **kwds)
>     111         # same_field=True might trigger an exception otherwise.
>     112 
> --> 113         numfield, new_elems, morphism = 
> number_field_elements_from_algebraics(orig_elems, same_field=True, 
> minimal=True)
>     114 
>     115         elem_dict = dict(zip(orig_elems, new_elems))
>
> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>  in number_field_elements_from_algebraics(numbers, minimal, same_field, 
> embedded, prec)
>    2759     real_numbers = []
>    2760     for v in numbers:
> -> 2761         if v._exact_field().is_complex() and real_case:
>    2762             # the number comes from a complex algebraic number field
>    2763             embedded_rt = v.interval_fast(RealIntervalField(prec))
>
> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>  in _exact_field(self)
>    4428         if isinstance(sd, (ANRational, ANExtensionElement)):
>    4429             return sd.generator()
> -> 4430         self.exactify()
>    4431         return self._exact_field()
>    4432 
>
> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>  in exactify(self)
>    4363         if isinstance(od, (ANRational, ANExtensionElement)):
>    4364             return
> -> 4365         self._set_descr(self._descr.exactify())
>    4366 
>    4367     def _set_descr(self, new_descr):
>
> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>  in exactify(self)
>    8180 
>    8181         if op == 'real':
> -> 8182             arg.exactify()
>    8183             rv = (arg + arg.conjugate()) / 2
>    8184             rv.exactify()
>
> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>  in exactify(self)
>    4363         if isinstance(od, (ANRational, ANExtensionElement)):
>    4364             return
> -> 4365         self._set_descr(self._descr.exactify())
>    4366 
>    4367     def _set_descr(self, new_descr):
>
> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>  in exactify(self)
>    8429             left = self._left
>    8430             right = self._right
> -> 8431             left.exactify()
>    8432             right.exactify()
>    8433             gen = left._exact_field().union(right._exact_field())
>
> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>  in exactify(self)
>    4363         if isinstance(od, (ANRational, ANExtensionElement)):
>    4364             return
> -> 4365         self._set_descr(self._descr.exactify())
>    4366 
>    4367     def _set_descr(self, new_descr):
>
> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>  in exactify(self)
>    8431             left.exactify()
>    8432             right.exactify()
> -> 8433             gen = left._exact_field().union(right._exact_field())
>    8434             left_value = gen(left._exact_value())
>    8435             right_value = gen(right._exact_value())
>
> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>  in union(self, other)
>    3230         op = QQx(op)
>    3231         # pari_nf = self._field.pari_nf()
> -> 3232         pari_nf = self.pari_field()
>    3233         factors = list(pari_nf.nffactor(op).lift())[0]
>    3234         x, y = QQxy.gens()
>
> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>  in pari_field(self)
>    3134         if self._pari_field is None:
>    3135             pari_pol = self._field.pari_polynomial("y")
> -> 3136             self._pari_field = pari_pol.nfinit(1)
>    3137         return self._pari_field
>    3138 
>
> cypari2/auto_gen.pxi in cypari2.gen.Gen_base.nfinit()
>
> KeyboardInterrupt:
>
> Suggestions ?
> ​
> Le samedi 29 janvier 2022 à 15:34:05 UTC+1, Emmanuel Charpentier a écrit :
>
>> Setup : Sage 9.5.rc1 running in Debian testing on core i7 + 16 GB RAM.
>>
>> def test(Size=2, Ring=QQ):
>>     from time import time as stime
>>     with seed(0):
>>         M = matrix(Ring, Size, Size, lambda u, v:Ring.random_element())
>>     t0 = stime()
>>     SL = M.eigenspaces_left(algebraic_multiplicity=True)
>>     t1 = stime()
>>     VL = M.eigenvectors_left()
>>     t2 = stime()
>>     return t1-t0, SL, t2-t1, VL
>>
>> test() runs as expected, as well as test(Size=5) and test(Ring=AA), with 
>> very reasonable runtimes (under a second, IIRC). But test(Size=3, 
>> Ring=AA) “never returns” (meaning that it hadn’t returned when I 
>> interrupted it after tens of minutes). Further exploration showec that 
>> neither M.eigenspaces_left(algebraic_multiplicity=True) nor 
>> M.eigenvectors_left() return.
>>
>> Is that an expected behaviour ?
>>
>> FWIW, stack trace at interruption :
>>
>> sage: AA3=test(Size=3, Ring=AA)
>> AA3=test(Size=3, Ring=AA)  C-c 
>> C-c---------------------------------------------------------------------------
>> AttributeError                            Traceback (most recent call last)
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in minpoly(self)
>>    4492         try:
>> -> 4493             return self._minimal_polynomial
>>    4494         except AttributeError:
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/structure/element.pyx
>>  in sage.structure.element.Element.__getattr__ 
>> (build/cythonized/sage/structure/element.c:4754)()
>>     493         """
>> --> 494         return self.getattr_from_category(name)
>>     495 
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/structure/element.pyx
>>  in sage.structure.element.Element.getattr_from_category 
>> (build/cythonized/sage/structure/element.c:4866)()
>>     506             cls = P._abstract_element_class
>> --> 507         return getattr_from_other_class(self, cls, name)
>>     508 
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/cpython/getattr.pyx
>>  in sage.cpython.getattr.getattr_from_other_class 
>> (build/cythonized/sage/cpython/getattr.c:2633)()
>>     360         dummy_error_message.name = name
>> --> 361         raise AttributeError(dummy_error_message)
>>     362     attribute = <object>attr
>>
>> AttributeError: 'sage.rings.real_mpfi.RealIntervalFieldElement' object has 
>> no attribute '_evaluate_polynomial'
>>
>> During handling of the above exception, another exception occurred:
>>
>> KeyboardInterrupt                         Traceback (most recent call last)
>> <ipython-input-344-ff7c46010ad2> in <module>
>> ----> 1 AA3=test(Size=Integer(3), Ring=AA)
>>
>> <string> in test(Size, Ring)
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/matrix/matrix2.pyx
>>  in sage.matrix.matrix2.Matrix.eigenspaces_left 
>> (build/cythonized/sage/matrix/matrix2.c:43588)()
>>    6270                     self = self.change_ring(F)
>>    6271                 A = self - alpha
>> -> 6272                 W = A.kernel()
>>    6273                 V.append((alpha, 
>> W.ambient_module().span_of_basis(W.basis()), e))
>>    6274             else:
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/matrix/matrix2.pyx
>>  in sage.matrix.matrix2.Matrix.left_kernel 
>> (build/cythonized/sage/matrix/matrix2.c:32440)()
>>    4947 
>>    4948         tm = verbose("computing left kernel for %sx%s matrix" % 
>> (self.nrows(), self.ncols()),level=1)
>> -> 4949         K = self.transpose().right_kernel(*args, **kwds)
>>    4950         self.cache('left_kernel', K)
>>    4951         verbose("done computing left kernel for %sx%s matrix" % 
>> (self.nrows(), self.ncols()),level=1,t=tm)
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/matrix/matrix2.pyx
>>  in sage.matrix.matrix2.Matrix.right_kernel 
>> (build/cythonized/sage/matrix/matrix2.c:31909)()
>>    4785 
>>    4786         # Go get the kernel matrix, this is where it all happens
>> -> 4787         M = self.right_kernel_matrix(*args, **kwds)
>>    4788 
>>    4789         ambient = R**self.ncols()
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/matrix/matrix2.pyx
>>  in sage.matrix.matrix2.Matrix.right_kernel_matrix 
>> (build/cythonized/sage/matrix/matrix2.c:30829)()
>>    4394 
>>    4395         if M is None and R in _Fields:
>> -> 4396             format, M = self._right_kernel_matrix_over_field()
>>    4397 
>>    4398         if M is None and R.is_integral_domain():
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/matrix/matrix2.pyx
>>  in sage.matrix.matrix2.Matrix._right_kernel_matrix_over_field 
>> (build/cythonized/sage/matrix/matrix2.c:27969)()
>>    3686         from sage.matrix.matrix_space import MatrixSpace
>>    3687         tm = verbose("computing right kernel matrix over an 
>> arbitrary field for %sx%s matrix" % (self.nrows(), self.ncols()),level=1)
>> -> 3688         E = self.echelon_form(*args, **kwds)
>>    3689         pivots = E.pivots()
>>    3690         pivots_set = set(pivots)
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/matrix/matrix2.pyx
>>  in sage.matrix.matrix2.Matrix.echelon_form 
>> (build/cythonized/sage/matrix/matrix2.c:52440)()
>>    7686         E = self.__copy__()
>>    7687         if algorithm == 'default':
>> -> 7688             v = E.echelonize(cutoff=cutoff, **kwds)
>>    7689         else:
>>    7690             v = E.echelonize(algorithm = algorithm, cutoff=cutoff, 
>> **kwds)
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/matrix/matrix2.pyx
>>  in sage.matrix.matrix2.Matrix.echelonize 
>> (build/cythonized/sage/matrix/matrix2.c:51817)()
>>    7583             if self.base_ring() in _Fields:
>>    7584                 if algorithm in ['classical', 'partial_pivoting', 
>> 'scaled_partial_pivoting', 'scaled_partial_pivoting_valuation']:
>> -> 7585                     self._echelon_in_place(algorithm)
>>    7586                 elif algorithm == 'strassen':
>>    7587                     self._echelon_strassen(cutoff)
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/matrix/matrix2.pyx
>>  in sage.matrix.matrix2.Matrix._echelon_in_place 
>> (build/cythonized/sage/matrix/matrix2.c:53308)()
>>    7848                 sig_check()
>>    7849                 for r in range(start_row, nr):
>> -> 7850                     if A.get_unsafe(r, c):
>>    7851                         pivots.append(c)
>>    7852                         a_inverse = ~A.get_unsafe(r, c)
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in __bool__(self)
>>    4043             right = sd._right if op is operator.sub else -sd._right
>>    4044 
>> -> 4045             lp = left.minpoly()
>>    4046             rp = right.minpoly()
>>    4047             if lp != rp:
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in minpoly(self)
>>    4493             return self._minimal_polynomial
>>    4494         except AttributeError:
>> -> 4495             self.exactify()
>>    4496             self._minimal_polynomial = self._descr.minpoly()
>>    4497             return self._minimal_polynomial
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in exactify(self)
>>    4363         if isinstance(od, (ANRational, ANExtensionElement)):
>>    4364             return
>> -> 4365         self._set_descr(self._descr.exactify())
>>    4366 
>>    4367     def _set_descr(self, new_descr):
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in exactify(self)
>>    8430             right = self._right
>>    8431             left.exactify()
>> -> 8432             right.exactify()
>>    8433             gen = left._exact_field().union(right._exact_field())
>>    8434             left_value = gen(left._exact_value())
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in exactify(self)
>>    4363         if isinstance(od, (ANRational, ANExtensionElement)):
>>    4364             return
>> -> 4365         self._set_descr(self._descr.exactify())
>>    4366 
>>    4367     def _set_descr(self, new_descr):
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in exactify(self)
>>    8430             right = self._right
>>    8431             left.exactify()
>> -> 8432             right.exactify()
>>    8433             gen = left._exact_field().union(right._exact_field())
>>    8434             left_value = gen(left._exact_value())
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in exactify(self)
>>    4363         if isinstance(od, (ANRational, ANExtensionElement)):
>>    4364             return
>> -> 4365         self._set_descr(self._descr.exactify())
>>    4366 
>>    4367     def _set_descr(self, new_descr):
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in exactify(self)
>>    8430             right = self._right
>>    8431             left.exactify()
>> -> 8432             right.exactify()
>>    8433             gen = left._exact_field().union(right._exact_field())
>>    8434             left_value = gen(left._exact_value())
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in exactify(self)
>>    4363         if isinstance(od, (ANRational, ANExtensionElement)):
>>    4364             return
>> -> 4365         self._set_descr(self._descr.exactify())
>>    4366 
>>    4367     def _set_descr(self, new_descr):
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in exactify(self)
>>    8176 
>>    8177         if op == '~':
>> -> 8178             arg.exactify()
>>    8179             return arg._descr.invert(None)
>>    8180 
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in exactify(self)
>>    4363         if isinstance(od, (ANRational, ANExtensionElement)):
>>    4364             return
>> -> 4365         self._set_descr(self._descr.exactify())
>>    4366 
>>    4367     def _set_descr(self, new_descr):
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in exactify(self)
>>    8431             left.exactify()
>>    8432             right.exactify()
>> -> 8433             gen = left._exact_field().union(right._exact_field())
>>    8434             left_value = gen(left._exact_value())
>>    8435             right_value = gen(right._exact_value())
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in union(self, other)
>>    3230         op = QQx(op)
>>    3231         # pari_nf = self._field.pari_nf()
>> -> 3232         pari_nf = self.pari_field()
>>    3233         factors = list(pari_nf.nffactor(op).lift())[0]
>>    3234         x, y = QQxy.gens()
>>
>> /usr/local/sage-9/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/rings/qqbar.py
>>  in pari_field(self)
>>    3134         if self._pari_field is None:
>>    3135             pari_pol = self._field.pari_polynomial("y")
>> -> 3136             self._pari_field = pari_pol.nfinit(1)
>>    3137         return self._pari_field
>>    3138 
>>
>> cypari2/auto_gen.pxi in cypari2.gen.Gen_base.nfinit()
>> KeyboardInterrupt:
>>
>> Any hint appreciated…
>> ​
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/565c243d-97ab-4166-a97a-19991dbbfb3en%40googlegroups.com.

Reply via email to