summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRelease Manager <release@sagemath.org>2016-05-30 12:10:20 +0200
committerVolker Braun <vbraun.name@gmail.com>2016-05-30 12:10:20 +0200
commit00a843681ab917afdd3fa589faa167989bd81811 (patch)
tree27fbe32d7c2e6a3000d520b32737eff2cdc66d85
parentTrac #17808: Preparse old-style octals as strings (diff)
parentA bug was added accidentally. Removed. (diff)
Trac #20660: Add Certificate to is_isomorphic() in the matroids package
We are going to add an option to get certificate when testing if two matroids are isomorphic. I will be doing this. URL: http://trac.sagemath.org/20660 Reported by: tara Ticket author(s): Tara Fife Reviewer(s): Michael Welsh
-rw-r--r--src/sage/matroids/basis_exchange_matroid.pxd2
-rw-r--r--src/sage/matroids/basis_exchange_matroid.pyx18
-rw-r--r--src/sage/matroids/basis_matroid.pxd2
-rw-r--r--src/sage/matroids/basis_matroid.pyx14
-rw-r--r--src/sage/matroids/circuit_closures_matroid.pxd2
-rw-r--r--src/sage/matroids/circuit_closures_matroid.pyx19
-rw-r--r--src/sage/matroids/linear_matroid.pxd8
-rw-r--r--src/sage/matroids/linear_matroid.pyx53
-rw-r--r--src/sage/matroids/matroid.pxd4
-rw-r--r--src/sage/matroids/matroid.pyx30
10 files changed, 117 insertions, 35 deletions
diff --git a/src/sage/matroids/basis_exchange_matroid.pxd b/src/sage/matroids/basis_exchange_matroid.pxd
index ad65cd8..e7dca68 100644
--- a/src/sage/matroids/basis_exchange_matroid.pxd
+++ b/src/sage/matroids/basis_exchange_matroid.pxd
@@ -89,7 +89,7 @@ cdef class BasisExchangeMatroid(Matroid):
cdef _flush(self)
cpdef _equitable_partition(self, P=*)
- cpdef _is_isomorphic(self, other)
+ cpdef _is_isomorphic(self, other, certificate=*)
cpdef _isomorphism(self, other)
cpdef _is_isomorphism(self, other, morphism)
cdef bint __is_isomorphism(self, BasisExchangeMatroid other, morphism)
diff --git a/src/sage/matroids/basis_exchange_matroid.pyx b/src/sage/matroids/basis_exchange_matroid.pyx
index b9110d1..88955d2 100644
--- a/src/sage/matroids/basis_exchange_matroid.pyx
+++ b/src/sage/matroids/basis_exchange_matroid.pyx
@@ -2242,7 +2242,7 @@ cdef class BasisExchangeMatroid(Matroid):
return self._characteristic_setsystem()._isomorphism(other._characteristic_setsystem(), PS, PO)
- cpdef _is_isomorphic(self, other):
+ cpdef _is_isomorphic(self, other, certificate=False):
"""
Test if ``self`` is isomorphic to ``other``.
@@ -2250,11 +2250,17 @@ cdef class BasisExchangeMatroid(Matroid):
INPUT:
- - ``other`` -- A matroid.
+ - ``other`` -- A matroid,
+ - optional parameter ``certificate`` -- Boolean.
OUTPUT:
- Boolean.
+ Boolean,
+ and, if certificate = True, a dictionary giving the isomophism or None
+
+ .. NOTE::
+
+ Internal version that does no input checking.
EXAMPLES::
@@ -2263,12 +2269,18 @@ cdef class BasisExchangeMatroid(Matroid):
sage: M2 = matroids.CompleteGraphic(4)
sage: M1._is_isomorphic(M2)
True
+ sage: M1._is_isomorphic(M2, certificate=True)
+ (True, {0: 0, 1: 1, 2: 2, 3: 3, 4: 5, 5: 4})
sage: M1 = BasisMatroid(matroids.named_matroids.Fano())
sage: M2 = matroids.named_matroids.NonFano()
sage: M1._is_isomorphic(M2)
False
+ sage: M1._is_isomorphic(M2, certificate=True)
+ (False, None)
"""
+ if certificate:
+ return self._is_isomorphic(other), self._isomorphism(other)
if not isinstance(other, BasisExchangeMatroid):
return other._is_isomorphic(self)
# Either generic test, which converts other to BasisMatroid,
diff --git a/src/sage/matroids/basis_matroid.pxd b/src/sage/matroids/basis_matroid.pxd
index f933083..4f53e89 100644
--- a/