# Ticket #10793: trac_10793_fixing_existing_bugs.patch

File trac_10793_fixing_existing_bugs.patch, 5.3 KB (added by Andrey Novoseltsev, 11 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 sage: V1 = QQ^2 sage: V2 = QQ^3 sage: phi1 = (QQ^1).hom(Matrix([[1],[1]]),V1) sage: phi2 = V1.hom(Matrix([[1,2],[3,4],[5,6]]),V2) sage: phi1 = (QQ^1).hom(Matrix([[1,1]]),V1) sage: phi2 = V1.hom(Matrix([[1,2,3],[4,5,6]]),V2) If both constituents are injective, the composition is injective:: If it can not be determined whether the composition is injective, an error is raised:: sage: psi1 = V2.hom(Matrix([[1,2,3],[4,5,6]]),V1) sage: psi1 = V2.hom(Matrix([[1,2],[3,4],[5,6]]),V1) sage: c2 = FormalCompositeMap(Hom(V1,V1,phi2.category_for()),phi2,psi1) sage: c2.is_injective() Traceback (most recent call last): If both maps are surjective, the composition is surjective:: sage: phi32 = V3.hom(Matrix([[1,2,3],[4,5,6]]),V2) sage: phi21 = V2.hom(Matrix([[1,1]]),V1) sage: phi32 = V3.hom(Matrix([[1,2],[3,4],[5,6]]),V2) sage: phi21 = V2.hom(Matrix([[1],[1]]),V1) sage: c_phi = FormalCompositeMap(Hom(V3,V1,phi32.category_for()),phi32,phi21) sage: c_phi.is_surjective() True Otherwise, surjectivity of the composition can not be determined:: sage: FormalCompositeMap(Hom(V2,V1,phi32.category_for()),V2.hom(Matrix([[1,1],[1,1]]),V2),V2.hom(Matrix([[1,1]]),V1)).is_surjective() sage: FormalCompositeMap(Hom(V2, V1, phi32.category_for()), ...     V2.hom(Matrix([[1,1], [1,1]]), V2), ...     V2.hom(Matrix([[1], [1]]), V1)).is_surjective() Traceback (most recent call last): ... NotImplementedError: Not enough information to deduce surjectivity.
• ## sage/crypto/mq/sr.py

`diff -r 8aca4c97bc58 -r dac7897e6bc6 sage/crypto/mq/sr.py`
 a if is_Matrix(d): if d.nrows() == r*c*e: return Matrix(k, c, r, self.antiphi(d)).transpose() return Matrix(k, c, r, self.antiphi(d).list()).transpose() elif d.ncols() == c and d.nrows() == r and d.base_ring() == k: return d if d is None: return Matrix(k, r*c*e, 1) elif d.ncols() == c and d.nrows() == r and d.base_ring() == k: return Matrix(k, r*c*e, 1, self.phi(d).transpose()) return Matrix(k, r*c*e, 1, self.phi(d).transpose().list()) def is_vector(self, d): """
• ## sage/geometry/fan_morphism.py

`diff -r 8aca4c97bc58 -r dac7897e6bc6 sage/geometry/fan_morphism.py`
 a EXAMPLES:: sage: fan = Fan(rays=[(1,0), (1,1), (0,1)], cones=[(0,1), (1,2)]) sage: fm = FanMorphism(matrix([1,-1]), fan, ToricLattice(1)) sage: fm = FanMorphism(matrix(2, 1, [1,-1]), fan, ToricLattice(1)) sage: fm.kernel_fan() Rational polyhedral fan in Sublattice sage: _.ray_matrix()
• ## sage/modules/matrix_morphism.py

`diff -r 8aca4c97bc58 -r dac7897e6bc6 sage/modules/matrix_morphism.py`
 a sage: phi + psi Traceback (most recent call last): ... TypeError: entries has the wrong length ValueError: a matrix from Full MatrixSpace of 3 by 3 dense matrices over Integer Ring cannot be converted to a matrix in Full MatrixSpace of 2 by 2 dense matrices over Integer Ring! """ # TODO: move over to any coercion model! if not isinstance(right, MatrixMorphism): sage: V1 = QQ^2 sage: V2 = QQ^3 sage: phi = V1.hom(Matrix([[1,2],[3,4],[5,6]]),V2) sage: phi = V1.hom(Matrix([[1,2,3],[4,5,6]]),V2) sage: phi.is_injective() True sage: psi = V2.hom(Matrix([[1,2,3],[4,5,6]]),V1) sage: psi = V2.hom(Matrix([[1,2],[3,4],[5,6]]),V1) sage: psi.is_injective() False sage: V1 = QQ^2 sage: V2 = QQ^3 sage: phi = V1.hom(Matrix([[1,2],[3,4],[5,6]]), V2) sage: phi = V1.hom(Matrix([[1,2,3],[4,5,6]]), V2) sage: phi.is_surjective() False sage: psi = V2.hom(Matrix([[1,2,3],[4,5,6]]), V1) sage: psi = V2.hom(Matrix([[1,2],[3,4],[5,6]]), V1) sage: psi.is_surjective() True