(* ::Package:: *)

(************************************************************************)
(* This file was generated automatically by the Mathematica front end.  *)
(* It contains Initialization cells from a Notebook file, which         *)
(* typically will have the same name as this file except ending in      *)
(* ".nb" instead of ".m".                                               *)
(*                                                                      *)
(* This file is intended to be loaded into the Mathematica kernel using *)
(* the package loading commands Get or Needs.  Doing so is equivalent   *)
(* to using the Evaluate Initialization Cells menu command in the front *)
(* end.                                                                 *)
(*                                                                      *)
(* DO NOT EDIT THIS FILE.  This entire file is regenerated              *)
(* automatically each time the parent Notebook file is saved in the     *)
(* Mathematica front end.  Any changes you make to this file will be    *)
(* overwritten.                                                         *)
(************************************************************************)



(* ::Input::Initialization:: *)
SetDirectory["C:\\drorbn\\AcademicPensieve\\Projects\\Signatures"];
<< Common.m


(* ::Input::Initialization:: *)
GoeritzSignature[K_]:=Module[{m=0,a,c=0,ds,cs,is,A},
ds=List@@PD[K]/.x:X[i_,j_,k_,l_]:>If[PositiveQ@x,
If[OddQ@i,{Subscript[a, -i,l][++c]Subscript[a, k,-j][++c],-1},
{Subscript[a, j,i][++c]Subscript[a, -l,-k][++c],++m;1}],
If[OddQ@i,{Subscript[a, -i,-l][++c]Subscript[a, k,j][++c],--m;-1},
{Subscript[a, -j,i][++c]Subscript[a, l,-k][++c],1}]];
cs=Times@@ds[[All,1]]//.Subscript[a, i_,j_][x__]Subscript[a, j_,k_][y__]:>Subscript[a, i,k][x,y]/.Subscript[a, __][x__]:>a[x];
A=Table[0,Length@cs,Length@cs];
Do[is=Position[cs,2i-#][[1,1]]&/@{1,0};
A[[is,is]]+=ds[[i,2]]{{1,-1},{-1,1}},
{i,Length[ds]} ];
MatrixSignature[A]-m ];



