Ticket #10793: trac_10793_fixing_existing_bugs.patch

File trac_10793_fixing_existing_bugs.patch, 5.3 KB (added by novoselt, 10 years ago)
  • sage/categories/map.pyx

    # HG changeset patch
    # User Andrey Novoseltsev <novoselt@gmail.com>
    # Date 1313617024 14400
    # Node ID dac7897e6bc609a8f9245a65faec27353a15a50e
    # Parent  8aca4c97bc5803990e26dfaca40c112e28af281a
    Fix wrong doctests that were working due to a bug in matrix constructor.
    
    diff -r 8aca4c97bc58 -r dac7897e6bc6 sage/categories/map.pyx
    a b  
    13931393
    13941394            sage: V1 = QQ^2
    13951395            sage: V2 = QQ^3
    1396             sage: phi1 = (QQ^1).hom(Matrix([[1],[1]]),V1)
    1397             sage: phi2 = V1.hom(Matrix([[1,2],[3,4],[5,6]]),V2)
     1396            sage: phi1 = (QQ^1).hom(Matrix([[1,1]]),V1)
     1397            sage: phi2 = V1.hom(Matrix([[1,2,3],[4,5,6]]),V2)
    13981398
    13991399        If both constituents are injective, the composition is injective::
    14001400
     
    14061406        If it can not be determined whether the composition is injective,
    14071407        an error is raised::
    14081408
    1409             sage: psi1 = V2.hom(Matrix([[1,2,3],[4,5,6]]),V1)
     1409            sage: psi1 = V2.hom(Matrix([[1,2],[3,4],[5,6]]),V1)
    14101410            sage: c2 = FormalCompositeMap(Hom(V1,V1,phi2.category_for()),phi2,psi1)
    14111411            sage: c2.is_injective()
    14121412            Traceback (most recent call last):
     
    14471447
    14481448        If both maps are surjective, the composition is surjective::
    14491449
    1450             sage: phi32 = V3.hom(Matrix([[1,2,3],[4,5,6]]),V2)
    1451             sage: phi21 = V2.hom(Matrix([[1,1]]),V1)
     1450            sage: phi32 = V3.hom(Matrix([[1,2],[3,4],[5,6]]),V2)
     1451            sage: phi21 = V2.hom(Matrix([[1],[1]]),V1)
    14521452            sage: c_phi = FormalCompositeMap(Hom(V3,V1,phi32.category_for()),phi32,phi21)
    14531453            sage: c_phi.is_surjective()
    14541454            True
     
    14671467
    14681468        Otherwise, surjectivity of the composition can not be determined::
    14691469
    1470             sage: FormalCompositeMap(Hom(V2,V1,phi32.category_for()),V2.hom(Matrix([[1,1],[1,1]]),V2),V2.hom(Matrix([[1,1]]),V1)).is_surjective()
     1470            sage: FormalCompositeMap(Hom(V2, V1, phi32.category_for()),
     1471            ...     V2.hom(Matrix([[1,1], [1,1]]), V2),
     1472            ...     V2.hom(Matrix([[1], [1]]), V1)).is_surjective()
    14711473            Traceback (most recent call last):
    14721474            ...
    14731475            NotImplementedError: Not enough information to deduce surjectivity.
  • sage/crypto/mq/sr.py

    diff -r 8aca4c97bc58 -r dac7897e6bc6 sage/crypto/mq/sr.py
    a b  
    10111011       
    10121012        if is_Matrix(d):
    10131013            if d.nrows() == r*c*e:
    1014                 return Matrix(k, c, r, self.antiphi(d)).transpose()
     1014                return Matrix(k, c, r, self.antiphi(d).list()).transpose()
    10151015            elif d.ncols() == c and d.nrows() == r and d.base_ring() == k:
    10161016                return d
    10171017       
     
    21262126        if d is None:
    21272127            return Matrix(k, r*c*e, 1)
    21282128        elif d.ncols() == c and d.nrows() == r and d.base_ring() == k:
    2129             return Matrix(k, r*c*e, 1, self.phi(d).transpose())
     2129            return Matrix(k, r*c*e, 1, self.phi(d).transpose().list())
    21302130
    21312131    def is_vector(self, d):
    21322132        """
  • sage/geometry/fan_morphism.py

    diff -r 8aca4c97bc58 -r dac7897e6bc6 sage/geometry/fan_morphism.py
    a b  
    12831283        EXAMPLES::
    12841284       
    12851285            sage: fan = Fan(rays=[(1,0), (1,1), (0,1)], cones=[(0,1), (1,2)])
    1286             sage: fm = FanMorphism(matrix([1,-1]), fan, ToricLattice(1))
     1286            sage: fm = FanMorphism(matrix(2, 1, [1,-1]), fan, ToricLattice(1))
    12871287            sage: fm.kernel_fan()
    12881288            Rational polyhedral fan in Sublattice <N(1, 1)>
    12891289            sage: _.ray_matrix()
  • sage/modules/matrix_morphism.py

    diff -r 8aca4c97bc58 -r dac7897e6bc6 sage/modules/matrix_morphism.py
    a b  
    335335            sage: phi + psi
    336336            Traceback (most recent call last):
    337337            ...
    338             TypeError: entries has the wrong length
     338            ValueError: a matrix from
     339            Full MatrixSpace of 3 by 3 dense matrices over Integer Ring
     340            cannot be converted to a matrix in
     341            Full MatrixSpace of 2 by 2 dense matrices over Integer Ring!
    339342        """
    340343        # TODO: move over to any coercion model!
    341344        if not isinstance(right, MatrixMorphism):
     
    806809
    807810            sage: V1 = QQ^2
    808811            sage: V2 = QQ^3
    809             sage: phi = V1.hom(Matrix([[1,2],[3,4],[5,6]]),V2)
     812            sage: phi = V1.hom(Matrix([[1,2,3],[4,5,6]]),V2)
    810813            sage: phi.is_injective()
    811814            True
    812             sage: psi = V2.hom(Matrix([[1,2,3],[4,5,6]]),V1)
     815            sage: psi = V2.hom(Matrix([[1,2],[3,4],[5,6]]),V1)
    813816            sage: psi.is_injective()
    814817            False
    815818
     
    827830
    828831            sage: V1 = QQ^2
    829832            sage: V2 = QQ^3
    830             sage: phi = V1.hom(Matrix([[1,2],[3,4],[5,6]]), V2)
     833            sage: phi = V1.hom(Matrix([[1,2,3],[4,5,6]]), V2)
    831834            sage: phi.is_surjective()
    832835            False
    833             sage: psi = V2.hom(Matrix([[1,2,3],[4,5,6]]), V1)
     836            sage: psi = V2.hom(Matrix([[1,2],[3,4],[5,6]]), V1)
    834837            sage: psi.is_surjective()
    835838            True
    836839