(* ::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.                                                         *)
(************************************************************************)



J[{i_,j_},{p1_,p2_},m_]:= Module[
{n=Norm[{p1,p2}]},
{pp1,pp2}={p1,p2}/n;
(* ( p1	p2
-p2	P1

)*)
 SparseArray[{
{i,i}->pp1,
{j,j}->pp1,
{i,j}->pp2,
{j,i}->-pp2,
Band[{1,1}]->1
},
{m,m}
]
]


J[{i_,j_,k_,l_},{p1_,p2_,p3_,p4_},m_]:= Module[
{n=Norm[{p1,p2,p3,p4}],pp1,pp2,pp3,pp4},
(* LinAlg+App 332(2001) 37-80 Fasbender p65 *)
(* ( p1	 p2	 p3	 p4
-p2	 p1	 p4	-p3
-p3	-p4	 p1	 p2
-p4	 p3	-p2	 p1

) *)
{pp1,pp2,pp3,pp4}={p1,p2,p3,p4}/n;
 SparseArray[{
{i,i}->pp1,  {i,j}->pp2,{i,k}->pp3, {i,l}->pp4,
{j,i}->-pp2,{j,j}->pp1,{j,k}->pp4,{j,l}->-pp3,
{k,i}->-pp3,{k,j}->-pp4,{k,k}->pp1,{k,l}->pp2,
{l,i}->-pp4,{l,j}->pp3,{l,k}->-pp2,{l,l}->pp1,
Band[{1,1}]->1
},
{m,m}
]
]


J[
{i1_,i2_,i3_,i4_,i5_,i6_,i7_,i8_},
{p1_,p2_,p3_,p4_,p5_,p6_,p7_,p8_},
m_]:= Module[
{n=Norm[{p1,p2,p3,p4,p5,p6,p7,p8}],
pp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