Ticket #10501: trac_10501-deprecate-adjoint.patch

File trac_10501-deprecate-adjoint.patch, 11.6 KB (added by rbeezer, 11 years ago)
  • sage/crypto/classical.py

    # HG changeset patch
    # User Rob Beezer <beezer@ups.edu>
    # Date 1292885494 28800
    # Node ID bea160d9915819066f5e032ce5b353c31265237a
    # Parent  1cb202e8a606dc2ab85489ff9df9cb4ea78c1aa1
    10501: deprecate adjoint of a matrix in favor of adjugate
    
    diff -r 1cb202e8a606 -r bea160d99158 sage/crypto/classical.py
    a b  
    15031503        m = self.block_length()
    15041504        MatZZ = MatrixSpace(ZZ, m)
    15051505        AZ = MatZZ([ [ A[i, j].lift() for j in range(m) ] for i in range(m) ])
    1506         AZ_adj = AZ.adjoint()
     1506        AZ_adj = AZ.adjugate()
    15071507        u, r, s = xgcd(A.det().lift(), S.ngens())
    15081508        if u != 1:
    15091509            raise ValueError("Argument:\n\n%s\n\nis not invertible." % (A))
  • sage/matrix/matrix2.pyx

    diff -r 1cb202e8a606 -r bea160d99158 sage/matrix/matrix2.pyx
    a b  
    56255625       """
    56265626        return self.__invert__()
    56275627
    5628     def adjoint(self):
    5629         """
    5630         Returns the adjoint matrix of self (matrix of cofactors).
     5628    def adjugate(self):
     5629        """
     5630        Returns the adjugate matrix of self (matrix of cofactors).
    56315631       
    56325632        OUTPUT:
    56335633       
    5634         - ``N`` - the adjoint matrix, such that
     5634        - ``N`` - the adjugate matrix, such that
    56355635          N \* M = M \* N = M.parent(M.det())
    56365636       
    56375637        ALGORITHM:
    56385638       
    5639         Use PARI whenever the method ``self._adjoint`` is included to do so
     5639        Use PARI whenever the method ``self._adjugate`` is included to do so
    56405640        in an inheriting class.  Otherwise, use a generic division-free
    56415641        algorithm to compute the characteristic polynomial and hence the
    5642         adjoint.
     5642        adjugate.
    56435643       
    56445644        The result is cached.
    56455645       
     
    56485648            sage: M = Matrix(ZZ,2,2,[5,2,3,4]) ; M
    56495649            [5 2]
    56505650            [3 4]
    5651             sage: N = M.adjoint() ; N
     5651            sage: N = M.adjugate() ; N
    56525652            [ 4 -2]
    56535653            [-3  5]
    56545654            sage: M * N
     
    56605660            sage: M = Matrix(QQ,2,2,[5/3,2/56,33/13,41/10]) ; M
    56615661            [  5/3  1/28]
    56625662            [33/13 41/10]
    5663             sage: N = M.adjoint() ; N
     5663            sage: N = M.adjugate() ; N
    56645664            [ 41/10  -1/28]
    56655665            [-33/13    5/3]
    56665666            sage: M * N
     
    56715671       
    56725672        - Unknown: No author specified in the file from 2009-06-25
    56735673        - Sebastian Pancratz (2009-06-25): Reflecting the change that
    5674           ``_adjoint`` is now implemented in this class
     5674          ``_adjugate`` is now implemented in this class
    56755675        """
    56765676       
    56775677        if self._nrows != self._ncols:
    56785678            raise ValueError, "self must be a square matrix"
    56795679       
    5680         X = self.fetch('adjoint')
     5680        X = self.fetch('adjugate')
    56815681        if not X is None:
    56825682            return X
    56835683       
    5684         X = self._adjoint()
    5685         self.cache('adjoint', X)
     5684        X = self._adjugate()
     5685        self.cache('adjugate', X)
    56865686        return X
    56875687
    5688     def _adjoint(self):
     5688    def adjoint(self):
    56895689        r"""
    5690         Returns the adjoint of self.
     5690        The adjoint() method has been deprecated, use adjugate() instead.'
     5691
     5692        EXAMPLE::
     5693
     5694            sage: A = matrix(SR, 2, range(4))
     5695            sage: A.adjoint()
     5696            doctest:...: DeprecationWarning: (Since Sage Version 4.6.2) The adjoint() method has been deprecated, use adjugate() instead
     5697        """
     5698        from sage.misc.misc import deprecation
     5699        deprecation('The adjoint() method has been deprecated, use adjugate() instead', 'Sage Version 4.6.2')
     5700
     5701    def _adjugate(self):
     5702        r"""
     5703        Returns the adjugate of self.
    56915704       
    56925705        OUTPUT:
    56935706       
    5694         - matrix - the adjoint of self
     5707        - matrix - the adjugate of self
    56955708       
    56965709        EXAMPLES:
    56975710       
     
    57015714            sage: A
    57025715            [ 1 24]
    57035716            [ 3  5]
    5704             sage: A._adjoint()
     5717            sage: A._adjugate()
    57055718            [  5 -24]
    57065719            [ -3   1]
    57075720       
     
    57185731            [       -2*t^2 + t + 3/2       7*t^2 + 1/2*t - 1       -6*t^2 + t - 2/11]
    57195732            [-7/3*t^2 - 1/2*t - 1/15         -2*t^2 + 19/8*t     -10*t^2 + 2*t + 1/2]
    57205733            [            6*t^2 - 1/2        -1/7*t^2 + 9/4*t       -t^2 - 4*t - 1/10]
    5721             sage: A._adjoint()
     5734            sage: A._adjugate()
    57225735            [          4/7*t^4 + 1591/56*t^3 - 961/70*t^2 - 109/80*t 55/7*t^4 + 104/7*t^3 + 6123/1540*t^2 - 959/220*t - 1/10       -82*t^4 + 101/4*t^3 + 1035/88*t^2 - 29/22*t - 1/2]
    57235736            [   -187/3*t^4 + 13/6*t^3 + 57/10*t^2 - 79/60*t - 77/300            38*t^4 + t^3 - 793/110*t^2 - 28/5*t - 53/220 -6*t^4 + 44/3*t^3 + 4727/330*t^2 - 1147/330*t - 487/660]
    57245737            [          37/3*t^4 - 136/7*t^3 - 1777/840*t^2 + 83/80*t      292/7*t^4 + 107/14*t^3 - 323/28*t^2 - 29/8*t + 1/2   61/3*t^4 - 25/12*t^3 - 269/120*t^2 + 743/240*t - 1/15]
     
    57375750            -4*x
    57385751            sage: A.charpoly('T')
    57395752            T^2 + (-x^10*y - x*y^2)*T - 4*x
    5740             sage: A.adjoint()
     5753            sage: A.adjugate()
    57415754            [x^10*y   -2*x]
    57425755            [    -2  x*y^2]
    5743             sage: A.adjoint() * A
     5756            sage: A.adjugate() * A
    57445757            [-4*x    0]
    57455758            [   0 -4*x]
    57465759       
     
    57495762            sage: A = matrix(ZZ, 0, 0)
    57505763            sage: A
    57515764            []
    5752             sage: A._adjoint()
     5765            sage: A._adjugate()
    57535766            []
    57545767            sage: A = matrix(ZZ, [[2]])
    57555768            sage: A
    57565769            [2]
    5757             sage: A._adjoint()
     5770            sage: A._adjugate()
    57585771            [1]
    57595772       
    57605773        NOTES:
     
    57645777        ring (commutative and with multiplicative identity).  The algorithm
    57655778        is described in full detail as Algorithm 3.1 in [Se02].
    57665779       
    5767         Note that this method does not utilise a lookup if the adjoint has
     5780        Note that this method does not utilise a lookup if the adjugate has
    57685781        already been computed previously, and it does not cache the result.
    5769         This is all left to the method `adjoint`.
     5782        This is all left to the method `adjugate`.
    57705783       
    57715784        REFERENCES:
    57725785       
     
    57985811       
    57995812        f = self.charpoly()
    58005813       
    5801         # Let A denote the adjoint of M, which we want to compute, and
     5814        # Let A denote the adjugate of M, which we want to compute, and
    58025815        # N denote a copy of M used to store powers of M.
    58035816        #
    58045817        A = f[1] * MS.identity_matrix()
     
    58135826       
    58145827        return A
    58155828
     5829    def _adjoint(self):
     5830        r"""
     5831        The _adjoint() method has been deprecated, and is not meant to be called by a user, try adjugate() instead.'
     5832
     5833        EXAMPLE::
     5834
     5835            sage: A = matrix(SR, 2, range(4))
     5836            sage: A._adjoint()
     5837            doctest:...: DeprecationWarning: (Since Sage Version 4.6.2) The _adjoint() method has been deprecated
     5838        """
     5839        from sage.misc.misc import deprecation
     5840        deprecation('The _adjoint() method has been deprecated', 'Sage Version 4.6.2')
     5841
    58165842    def gram_schmidt(self):
    58175843        r"""
    58185844        Return the matrix G whose rows are obtained from the rows of self
  • sage/matrix/matrix_integer_dense.pyx

    diff -r 1cb202e8a606 -r bea160d99158 sage/matrix/matrix_integer_dense.pyx
    a b  
    24982498        else:
    24992499            return A
    25002500
    2501     def _adjoint(self):
     2501    def _adjugate(self):
    25022502        """
    2503         Return the adjoint of this matrix.
    2504        
    2505         Assumes self is a square matrix (checked in adjoint).
     2503        Return the adjugate of this matrix.
     2504       
     2505        Assumes self is a square matrix (checked in adjugate).
    25062506       
    25072507        EXAMPLES::
    25082508       
    25092509            sage: m = matrix(ZZ,3,[1..9])
    2510             sage: m.adjoint()
     2510            sage: m.adjugate()
    25112511            [ -3   6  -3]
    25122512            [  6 -12   6]
    25132513            [ -3   6  -3]
    25142514        """
    25152515        return self.parent()(self._pari_().matadjoint().python())
    25162516
     2517    def _adjoint(self):
     2518        r"""
     2519        The _adjoint() method has been deprecated, and is not meant to be called by a user, try adjugate() instead.'
     2520
     2521        EXAMPLE::
     2522
     2523            sage: A = matrix(SR, 2, range(4))
     2524            sage: A._adjoint()
     2525            doctest:...: DeprecationWarning: (Since Sage Version 4.6.2) The _adjoint() method has been deprecated
     2526        """
     2527        from sage.misc.misc import deprecation
     2528        deprecation('The _adjoint() method has been deprecated', 'Sage Version 4.6.2')
     2529
    25172530    def _ntl_(self):
    25182531        r"""
    25192532        ntl.mat_ZZ representation of self.
  • sage/matrix/matrix_rational_dense.pyx

    diff -r 1cb202e8a606 -r bea160d99158 sage/matrix/matrix_rational_dense.pyx
    a b  
    11491149                mpq_mul(self._matrix[i][j], self._matrix[i][j], a)
    11501150        sig_off()       
    11511151
    1152     def _adjoint(self):
     1152    def _adjugate(self):
    11531153        """
    1154         Return the adjoint of this matrix.
     1154        Return the adjugate of this matrix.
    11551155       
    1156         Assumes self is a square matrix (checked in adjoint).
     1156        Assumes self is a square matrix (checked in adjugate).
    11571157       
    11581158        EXAMPLES::
    11591159       
     
    11611161            [1/9 2/9 1/3]
    11621162            [4/9 5/9 2/3]
    11631163            [7/9 8/9   1]
    1164             sage: m.adjoint()
     1164            sage: m.adjugate()
    11651165            [-1/27  2/27 -1/27]
    11661166            [ 2/27 -4/27  2/27]
    11671167            [-1/27  2/27 -1/27]
    11681168        """
    11691169        return self.parent()(self._pari_().matadjoint().python())
    11701170
     1171    def _adjoint(self):
     1172        r"""
     1173        The _adjoint() method has been deprecated, and is not meant to be called by a user, try adjugate() instead.'
     1174
     1175        EXAMPLE::
     1176
     1177            sage: A = matrix(SR, 2, range(4))
     1178            sage: A._adjoint()
     1179            doctest:...: DeprecationWarning: (Since Sage Version 4.6.2) The _adjoint() method has been deprecated
     1180        """
     1181        from sage.misc.misc import deprecation
     1182        deprecation('The _adjoint() method has been deprecated', 'Sage Version 4.6.2')
     1183
    11711184    def _magma_init_(self, magma):
    11721185        """
    11731186        EXAMPLES::
  • sage/quadratic_forms/quadratic_form.py

    diff -r 1cb202e8a606 -r bea160d99158 sage/quadratic_forms/quadratic_form.py
    a b  
    12291229            [ *  1 ]
    12301230
    12311231        """
    1232         return QuadraticForm(self.Hessian_matrix().adjoint()).primitive()       
     1232        return QuadraticForm(self.Hessian_matrix().adjugate()).primitive()
    12331233   
    12341234
    12351235
  • sage/quadratic_forms/quadratic_form__ternary_Tornaria.py

    diff -r 1cb202e8a606 -r bea160d99158 sage/quadratic_forms/quadratic_form__ternary_Tornaria.py
    a b  
    115115def adjoint(self):
    116116    """
    117117    This gives the adjoint (integral) quadratic form associated to the
    118     given form, essentially defined by taking the adjoint of the matrix.
     118    given form, essentially defined by taking the adjugate of the matrix.
    119119
    120120    EXAMPLES::
    121121
     
    136136
    137137    """
    138138    if is_odd(self.dim()):
    139         return QuadraticForm(self.matrix().adjoint()*2)
     139        return QuadraticForm(self.matrix().adjugate()*2)
    140140    else:
    141         return QuadraticForm(self.matrix().adjoint())
     141        return QuadraticForm(self.matrix().adjugate())
    142142
    143143
    144144def antiadjoint(self):