Ticket #12051: 12051_LLL_QQ.patch

File 12051_LLL_QQ.patch, 1.3 KB (added by johanbosman, 9 years ago)
  • sage/matrix/matrix_rational_dense.pyx

    # HG changeset patch
    # User Johan Bosman <johan.g.bosman@gmail.com>
    # Date 1324585707 -3600
    # Node ID c57a231181bbb638b54de7de65484e801280df89
    # Parent  05abf540cc7c8a6b8c9edc3d6e263170a1f762d3
    Trac 12051: LLL for matrices over QQ.
    
    diff --git a/sage/matrix/matrix_rational_dense.pyx b/sage/matrix/matrix_rational_dense.pyx
    a b  
    27172717            mpq_init(v._entries[j]); mpq_set(v._entries[j], self._matrix[j][i])
    27182718        return v
    27192719
     2720    ################################################
     2721    # LLL
     2722    ################################################
     2723   
     2724    def LLL(self, *args, **kwargs):
     2725        """
     2726        Return an LLL reduced or approximated LLL reduced lattice for
     2727        ``self`` interpreted as a lattice.
     2728       
     2729        For details on input parameters, see
     2730        :meth:`sage.matrix.matrix_integer_dense.Matrix_integer_dense.LLL`.
     2731       
     2732        EXAMPLE::
     2733       
     2734            sage: A = Matrix(QQ, 3, 3, [1/n for n in range(1, 10)])
     2735            sage: A.LLL()
     2736            [ 1/28 -1/40 -1/18]
     2737            [ 1/28 -1/40  1/18]
     2738            [    0 -3/40     0]
     2739        """
     2740        A, d = self._clear_denom()
     2741        return A.LLL(*args, **kwargs) / d
     2742       
    27202743
    27212744cdef new_matrix_from_pari_GEN(parent, GEN d):
    27222745    """