(* ::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:: *)
\[Chi][cond_]:=If[TrueQ[cond],1,0];
IN[i_,j_,k_,l_]:=\[Chi][i>l]+\[Chi][j>k]-\[Chi][i>k]-\[Chi][j>l]


(* ::Input::Initialization:: *)
SCs[\[Beta]_BR]:=Module[{n=\[Beta][[1]]},Flatten@Table[
SC@@@Subsets[Flatten@Position[Abs[\[Beta][[2]]],k],{2}],{k,n-1}] ]


(* ::Input::Initialization:: *)
lk[\[Beta]_BR,SC[i_,j_],SC[k_,l_]]:=Module[
{n=\[Beta][[1]],s1=Abs@\[Beta][[2,i]],s2=Abs@\[Beta][[2,k]]},
Which[
s2-s1==1,IN[i,j,l,k],
s1==s2,\[Chi][\[Beta][[2,i]]>0](\[Chi][i==l]-\[Chi][i==k])+\[Chi][\[Beta][[2,j]]>0](\[Chi][j==k]-\[Chi][j==l])-IN[i+0.1,j+0.1,k,l],
True, 0] ]


(* ::Input::Initialization:: *)
SM[\[Beta]_BR]:=SM[\[Beta]]=Module[{n=\[Beta][[1]],col,H1},
H1=Flatten@Table[
col=Flatten@Position[Abs[\[Beta][[2]]],k];
SC[First@col,#]&/@Rest[col],
{k,n-1}];
Table[lk[\[Beta],sc1,sc2], {sc1,H1}, {sc2,H1}] ];


(* ::Input::Initialization:: *)
AlexFromSM[K_]:=Module[{A=SM@BR@K},Det[t A-A\[Transpose]]]


(* ::Input::Initialization:: *)
SignatureFromSM[K_]:=Module[{A=SM@BR@K}, MatrixSignature[A+A\[Transpose]]]


(* ::Input::Initialization:: *)
TLSFromSM[K_,\[Omega]_]:=Module[{A=SM@BR@K}, MatrixSignature[(1-\[Omega])A+(1-\[Omega]\[Conjugate])A\[Transpose]]]



