Unable to run GNFS code from Wiliam Stien, exiting with attribute error

72 views
Skip to first unread message

Anil Yadav

unread,
Dec 17, 2014, 11:47:52 PM12/17/14
to sage-s...@googlegroups.com
Hi all,
I am trying to run gnfs code from this link (http://wstein.org/wiki/ant07%282f%29projects%282f%29shumow_raw.html) in sage. I am getting following error;

AttributeError                            Traceback (most recent call last)
<ipython-input-3-8436e5dd60a9> in <module>()
----> 1 GNFS_Factoring_Algorithm(Integer(99999));

<string> in GNFS_Factoring_Algorithm(N)

<string> in compute_difference_of_squares(polynomial_ring, f, m, N, integer_pairs, vector)

<string> in compute_numberfield_product_of_pairs(polynomial_ring, f, integer_pairs, vector)

/home/anil/sage/sage-6.3/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_element.so in sage.rings.polynomial.polynomial_element.Polynomial.mod (build/cythonized/sage/rings/polynomial/polynomial_element.c:19549)()

/home/anil/sage/sage-6.3/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_element.so in sage.rings.polynomial.polynomial_element.Polynomial.__mod__ (build/cythonized/sage/rings/polynomial/polynomial_element.c:19406)()

/home/anil/sage/sage-6.3/local/lib/python2.7/site-packages/sage/structure/element.so in sage.structure.element.NamedBinopMethod.__call__ (build/cythonized/sage/structure/element.c:25224)()

/home/anil/sage/sage-6.3/local/lib/python2.7/site-packages/sage/structure/element.so in sage.structure.element.Element.__getattr__ (build/cythonized/sage/structure/element.c:4022)()

/home/anil/sage/sage-6.3/local/lib/python2.7/site-packages/sage/structure/misc.so in sage.structure.misc.getattr_from_other_class (build/cythonized/sage/structure/misc.c:1775)()

AttributeError: 'Ideal_principal' object has no attribute 'quo_rem'


I never had this problem with the previous installation. Unfortunately due to my OS crashing, I had to install it all over again. So far, I have installed two versions i.e. 6.4 and 6.3. both are giving the same error. Please suggest some way out.
Thanks
Anil

Anil Yadav

unread,
Dec 18, 2014, 1:01:10 AM12/18/14
to sage-s...@googlegroups.com
I forgot to post the OS. I am running it on Ubuntu 14.10 presently. Previously when things were working, I was using Ubunto 12.04LTS.
Anil

slelievre

unread,
Dec 18, 2014, 5:51:33 AM12/18/14
to sage-s...@googlegroups.com


Le jeudi 18 décembre 2014 07:01:10 UTC+1, Anil Yadav a écrit :
I forgot to post the OS. I am running it on Ubuntu 14.10 presently. Previously when things were working, I was using Ubunto 12.04LTS.
Anil

In the function:

    def compute_numberfield_product_of_pairs(polynomial_ring, f, integer_pairs, vector):

remove

        I = polynomial_ring.ideal(f)

and change

            product_polynomial.mod(I)

to:

            product_polynomial = product_polynomial.mod(f)

This should work.

The modified function is as follows:

def compute_numberfield_product_of_pairs(polynomial_ring, f, integer_pairs, vector):
    product_polynomial = polynomial_ring([1])
    for j in xrange(len(vector)):
        if (1 == vector[j]):
            linear_poly = polynomial_ring([integer_pairs[j][0], integer_pairs[j][1]])
            product_polynomial = product_polynomial * linear_poly
            product_polynomial = product_polynomial.mod(f)
    return product_polynomial

Best, slelievre

Anil Yadav

unread,
Dec 18, 2014, 6:27:54 AM12/18/14
to sage-s...@googlegroups.com
Hi Slelievre,
Thanks for your reply and it worked fine. I just wanted to know why the original code worked on Ubuntu 12.04 and a previous version of Sage(I don't remember which version) and not on this version.
Thanks
Anil
Reply all
Reply to author
Forward
0 new messages