#17406: sage.crypto.gen_lattice: quotient parameter should accept polynomials
----------------------------+----------------------------
   Reporter:  jdemeyer      |            Owner:
       Type:  defect        |           Status:  new
   Priority:  minor         |        Milestone:  sage-6.5
  Component:  cryptography  |         Keywords:
  Merged in:                |          Authors:
  Reviewers:                |  Report Upstream:  N/A
Work issues:                |           Branch:
     Commit:                |     Dependencies:
   Stopgaps:                |
----------------------------+----------------------------
 This works:
 {{{
 sage: var('x')
 x
 sage: sage.crypto.gen_lattice(type='ideal', seed=42, quotient=x^4-1)
 [11  0  0  0  0  0  0  0]
 [ 0 11  0  0  0  0  0  0]
 [ 0  0 11  0  0  0  0  0]
 [ 0  0  0 11  0  0  0  0]
 [ 4 -2 -3 -3  1  0  0  0]
 [-3  4 -2 -3  0  1  0  0]
 [-3 -3  4 -2  0  0  1  0]
 [-2 -3 -3  4  0  0  0  1]
 }}}

 But this should also work:
 {{{
 sage: R.<x> = ZZ[]
 sage: sage.crypto.gen_lattice(type='ideal', seed=42, quotient=x^4-1)
 ---------------------------------------------------------------------------
 AttributeError                            Traceback (most recent call
 last)
 <ipython-input-11-387441ec01a8> in <module>()
 ----> 1 sage.crypto.gen_lattice(type='ideal', seed=Integer(42),
 quotient=x**Integer(4)-Integer(1))

 /usr/local/src/sage-config/local/lib/python2.7/site-
 packages/sage/crypto/lattice.pyc in gen_lattice(type, n, m, q, seed,
 quotient, dual, ntl, lattice)
     215         if quotient is None: raise \
     216             ValueError('ideal bases require a quotient
 polynomial')
 --> 217         x = quotient.default_variable()
     218         if n != quotient.degree(x): raise \
     219             ValueError('ideal bases require n  =
 quotient.degree()')

 /usr/local/src/sage-config/local/lib/python2.7/site-
 packages/sage/structure/element.so in
 sage.structure.element.Element.__getattr__
 (build/cythonized/sage/structure/element.c:4074)()

 /usr/local/src/sage-config/local/lib/python2.7/site-
 packages/sage/structure/misc.so in
 sage.structure.misc.getattr_from_other_class
 (build/cythonized/sage/structure/misc.c:1631)()

 AttributeError:
 
'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint'
 object has no attribute 'default_variable'
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/17406>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to