Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
darijgr committed Jan 20, 2016
1 parent 4997564 commit 2417129
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
33 changes: 26 additions & 7 deletions src/sage/algebras/orlik_solomon.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from sage.misc.cachefunc import cached_method
from sage.combinat.free_module import CombinatorialFreeModule
from sage.categories.algebras import Algebras
from sage.rings.arith import binomial
from sage.sets.family import Family

class OrlikSolomonAlgebra(CombinatorialFreeModule):
Expand All @@ -36,8 +35,9 @@ class OrlikSolomonAlgebra(CombinatorialFreeModule):
for all `S = \left\{ j_1 < j_2 < \cdots < j_t \right\} \in C(M)`,
where `\widehat{e}_{j_i}` means that the term `e_{j_i}` is being
omitted. (The notation `\partial e_S` is not a coincidence, as
`\partial e_S` is actually the image of `e_S` under the unique
derivation `\partial` of `E` which sends all `e_x` to `1`.)
`\partial e_S` is actually the image of
`e_S := e_{j_1} \wedge e_{j_2} \wedge \cdots \wedge e_{j_t}` under the
unique derivation `\partial` of `E` which sends all `e_x` to `1`.)
The *Orlik-Solomon algebra* `A(M)` is the quotient `E / J(M)`. Fix
some ordering on `X`; then, the NBC sets of `M` (that is, the subsets
Expand Down Expand Up @@ -102,7 +102,7 @@ def __init__(self, R, M, ordering=None):

def _repr_term(self, m):
"""
Return a string representation of the term indexed by `m`.
Return a string representation of the basis element indexed by `m`.
EXAMPLES::
Expand Down Expand Up @@ -139,22 +139,36 @@ def one_basis(self):
sage: OS.one_basis() == frozenset([])
True
"""
return frozenset({})
return frozenset({})

@cached_method
def algebra_generators(self):
"""
Return the algebra generators of ``self``.
These form a family indexed by the ground set `X` of `M`. For
each `x \in X`, the `x`-th element is `e_x`.
EXAMPLES::
sage: M = matroids.Uniform(3, 2)
sage: M = matroids.Uniform(2, 2)
sage: OS = M.orlik_solomon_algebra(QQ)
sage: OS.algebra_generators()
Finite family {0: OS{0}, 1: OS{1}}
sage: M = matroids.Uniform(1, 2)
sage: OS = M.orlik_solomon_algebra(QQ)
sage: OS.algebra_generators() # does not yet work
Finite family {0: OS{0}, 1: OS{0}}
sage: M = matroids.Uniform(1, 3)
sage: OS = M.orlik_solomon_algebra(QQ)
sage: OS.algebra_generators() # does not yet work
Finite family {0: OS{0}, 1: OS{0}, 2: OS{0}}
"""
return Family(sorted(self._M.groundset()),
lambda i: self.monomial(frozenset([i])))
# BUG: frozenset([i]) is not always an nbc-set (see doctests above).

@cached_method
def product_on_basis(self, a, b):
Expand Down Expand Up @@ -221,7 +235,11 @@ def product_on_basis(self, a, b):
# r is the accumalator
# we reverse a in the product, so add a sign
# note that l>=2 here
r = self._from_dict({b: R((-1)**binomial(len(a),2))}, remove_zeros=False)
if len(a) % 4 < 2:
sign = R.one()
else:
sign = - R.one()
r = self._from_dict({b: sign}, remove_zeros=False)

# now do the multiplication generator by generator
G = self.algebra_generators()
Expand Down Expand Up @@ -255,6 +273,7 @@ def _reduce_broken_circuit(self, bc):
c = self.base_ring().one()
for j in sorted(bc, key=lambda x: self._sorting[x]):
r += self._from_dict({bc.symmetric_difference({i,j}): c},
# BUG: bc.symmetric_difference({i,j}) is not always an NBC-set, hence r might be malformed
remove_zeros=False)
c *= -1
return r
Expand Down
7 changes: 4 additions & 3 deletions src/sage/matroids/matroid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2814,9 +2814,10 @@ cdef class Matroid(SageObject):
r"""
Return the list of broken circuits of ``self``.
A *broken circuit* `B` for is a subset of the ground set under
some total ordering `<` such that `B \cup \{ u \}` is a circuit
and `u < b` for all `b \in B`.
Let `M` be a matroid with ground set `E`, and let `<` be a total
ordering on `E`. A *broken circuit* for `M` means a subset `B` of
`E` such that there exists a `u \in E` for which `B \cup \{ u \}`
is a circuit of `M` and `u < b` for all `b \in B`.
INPUT:
Expand Down

0 comments on commit 2417129

Please sign in to comment.