File: sc

package info (click to toggle)
frobby 0.9.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 11,616 kB
  • sloc: cpp: 30,134; sh: 1,184; makefile: 306; ansic: 102; lisp: 10
file content (23 lines) | stat: -rw-r--r-- 455 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
loadPackage "SimplicialComplexes"

eul = I -> (
  R := ring I;
  if not isSquareFree I then (
    print "not square free!";
    exit 1;
  );
  if I == monomialIdeal(1_R) then
    return (if gens R == {} then -1 else 0);

  if I == monomialIdeal(0_R) then
    return 0;

  h := fVector simplicialComplex dual I;

  eulerC := 0;
  for i in keys h do
    eulerC = eulerC + h#i * (-1)^i;
  return eulerC;
);

stderr << (eul I) << "\n";