]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
Add back the drop_dependent() function.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 7 Jun 2015 04:42:39 +0000 (00:42 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 7 Jun 2015 04:42:39 +0000 (00:42 -0400)
It turns out that it doesn't matter if our basis is orthogonal, so we
don't need to do Gram-Schmidt. Since this will be relied upon in the
paper, we go back to using (a subset of) the rays of the cone as our
basis.

mjo/cone/cone.py

index 87cdf704580e68b55fa72cd93b8dfa6c1d08a484..8adc51cdd4836e8d1a405fb342f6c4bb8fa50fb6 100644 (file)
@@ -8,6 +8,26 @@ addsitedir(abspath('../../'))
 from sage.all import *
 
 
+def drop_dependent(vs):
+    r"""
+    Return the largest linearly-independent subset of ``vs``.
+    """
+    if len(vs) == 0:
+        # ...for lazy enough definitions of linearly-independent
+        return vs
+
+    result = []
+    old_V = VectorSpace(vs[0].parent().base_field(), 0)
+
+    for v in vs:
+        new_V = span(result + [v])
+        if new_V.dimension() > old_V.dimension():
+            result.append(v)
+            old_V = new_V
+
+    return result
+
+
 def basically_the_same(K1,K2):
     r"""
     ``True`` if ``K1`` and ``K2`` are basically the same, and ``False``
@@ -56,7 +76,7 @@ def iso_space(K):
     # Create the space W \times W^{\perp} isomorphic to V.
     # First we get an orthogonal (but not normal) basis...
     M = matrix(V.base_field(), K.rays())
-    W_basis,_ = M.gram_schmidt()
+    W_basis = drop_dependent(K.rays())
 
     W = V.subspace_with_basis(W_basis)
     W_perp = W.complement()