Opened 10 years ago
Closed 10 years ago
#11553 closed enhancement (fixed)
Matrix morphism additions
Reported by:  rbeezer  Owned by:  jason, was 

Priority:  minor  Milestone:  sage4.7.2 
Component:  linear algebra  Keywords:  sd32 bijective identity inverse 
Cc:  SimonKing, mmarco  Merged in:  sage4.7.2.alpha3 
Authors:  Rob Beezer  Reviewers:  Martin Raum 
Report Upstream:  N/A  Work issues:  
Branch:  Commit:  
Dependencies:  #11552 #10793  Stopgaps: 
Description (last modified by )
Adds three methods to the matrix morphism class:

is_bijective()

is_identity()

inverse()
I did not notice that __invert__
via ~ was available by using tabcompletion, which should explain the last one.
If there is a theme, it is better support for compositions of these morphisms.
Depends
Apply:
Attachments (7)
Change History (22)
Changed 10 years ago by
comment:1 Changed 10 years ago by
 Cc SimonKing mmarco added
 Dependencies set to #11552
 Description modified (diff)
 Status changed from new to needs_review
comment:2 Changed 10 years ago by
comment:3 Changed 10 years ago by
Strikes me there is a more general problem with free module equality, which I will ask about on sagedevel:
sage: R = PolynomialRing(QQ, 'a') sage: x = vector(R, [1, 0]) sage: y = vector(R, [0, 1]) sage: z = vector(R, [0,1]) sage: A = (R^2).span([x, y]) sage: B = (R^2).span([x, z]) sage: A == B False sage: A.is_submodule(B) True sage: B.is_submodule(A) True
which at its root might be
sage: S = matrix([x, y]) sage: S._echelon_form_PID()[1] [1 0] [0 1] sage: T = matrix([x, z]) sage: T._echelon_form_PID()[1] [ 1 0] [ 0 1]
comment:4 Changed 10 years ago by
Changed 10 years ago by
comment:5 Changed 10 years ago by
 Description modified (diff)
v2 patch adds a nullity()
method for matrix morphisms, as a companion to the rank()
method.
Changed 10 years ago by
comment:6 Changed 10 years ago by
 Description modified (diff)
v3 patch makes is_identity()
more robust, adds is_zero()
and a test to see if two matrix morphisms are equal as functions, not just that they have the same representation.
A few methods are relocated within the file, as well, to group things more logically.
Changed 10 years ago by
comment:7 Changed 10 years ago by
 Description modified (diff)
 Reviewers set to Martin Raum
I made some very minor changes to how to access the associated matrices. Also I added a one line documentation to the trace method. Please have a look at this and if every thing is OK, you can give it a positive review.
comment:8 Changed 10 years ago by
 Status changed from needs_review to positive_review
Martin,
Thanks for the improvements. The changes in the review patch look good to me, and pass tests in sage/modules, sage/matrix. So, as suggested, I've set this to positive review.
Rob
comment:9 Changed 10 years ago by
 Dependencies changed from #11552 to #11552, #10793
 Status changed from positive_review to needs_work
This should be rebased to #10793 because of doctest failures:
sage t force_lib devel/sage/sage/modules/matrix_morphism.py ********************************************************************** File "/mnt/usb1/scratch/jdemeyer/merger/sage4.7.2.alpha2/devel/sagemain/sage/modules/matrix_morphism.py", line 826: sage: phi = V1.hom(m, V2) Exception raised: Traceback (most recent call last): File "/mnt/usb1/scratch/jdemeyer/merger/sage4.7.2.alpha2/local/bin/ncadoctest.py", line 1231, in run_one_test self.run_one_example(test, example, filename, compileflags) File "/mnt/usb1/scratch/jdemeyer/merger/sage4.7.2.alpha2/local/bin/sagedoctest.py", line 38, in run_one_example OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags) File "/mnt/usb1/scratch/jdemeyer/merger/sage4.7.2.alpha2/local/bin/ncadoctest.py", line 1172, in run_one_example compileflags, 1) in test.globs File "<doctest __main__.example_26[5]>", line 1, in <module> phi = V1.hom(m, V2)###line 826: sage: phi = V1.hom(m, V2) File "parent_gens.pyx", line 471, in sage.structure.parent_gens.ParentWithGens.hom (sage/structure/parent_gens.c:3949) File "/mnt/usb1/scratch/jdemeyer/merger/sage4.7.2.alpha2/local/lib/python/sitepackages/sage/modules/free_module_homspace.py", line 163, in __call__ return free_module_morphism.FreeModuleMorphism(self, A) File "/mnt/usb1/scratch/jdemeyer/merger/sage4.7.2.alpha2/local/lib/python/sitepackages/sage/modules/free_module_morphism.py", line 83, in __init__ A = parent._matrix_space()(A) File "/mnt/usb1/scratch/jdemeyer/merger/sage4.7.2.alpha2/local/lib/python/sitepackages/sage/matrix/matrix_space.py", line 451, in __call__ return self.matrix(entries, copy=copy, coerce=coerce, rows=rows) File "/mnt/usb1/scratch/jdemeyer/merger/sage4.7.2.alpha2/local/lib/python/sitepackages/sage/matrix/matrix_space.py", line 1221, in matrix "a matrix in %s!" % (x.parent(), self)) ValueError: a matrix from Full MatrixSpace of 3 by 2 dense matrices over Rational Field cannot be converted to a matrix in Full MatrixSpace of 2 by 3 dense matrices over Rational Field! **********************************************************************
comment:10 Changed 10 years ago by
 Description modified (diff)
 Status changed from needs_work to needs_review
4.7.2.alpha1 + #11552 + #10793
Rebased main patch to make v4 patch. This was a trivial change.
Got bit by the nasty bug that is fixed in #10793, so two doctests needed to have their matrix dimensions reversed (maybe not really transposes per se). This minor change to the code is on the "doctests" patch and should require a (simple) review.
comment:11 Changed 10 years ago by
 Status changed from needs_review to positive_review
comment:12 Changed 10 years ago by
 Keywords sd32 added
comment:13 Changed 10 years ago by
 Description modified (diff)
 Keywords bijective identity inverse added
Changed 10 years ago by
comment:14 Changed 10 years ago by
 Description modified (diff)
"reviewv2" patch is a trivial rebase to eliminate a fuzz warning. I'm going to presume this does not need a change in review status.
comment:15 Changed 10 years ago by
 Dependencies changed from #11552, #10793 to #11552 #10793
 Merged in set to sage4.7.2.alpha3
 Resolution set to fixed
 Status changed from positive_review to closed
The surjectivity test doesn't work fine over other euclidian domains:
But
I think the problem is in ticket 11552, it still needs work.