(* GenWPx.nb ------------------------------------------------------------ *)

(* Writes out the polynomials WP(x) for all posets in the given list. *)

(* Utility Needed: WriteLstOfLst[]. *)
(* Functions Needed: WPx[], InvExtsWRI[]. *)
(* Data Needed: stdisos*, lookups*, invexts* for 4 <= * <= 7. *) 

(* User must specify the directory, a poset size, and input and output 
	file sudirectory/names. *)

(* Change Diretory: *)
SetDirectory["J:/isis/home/c/a/cagann/public_html/Posets"];

<< GenrlUtils.m;   << PosetUtils.m;   << InvExIsoFncts.m;   << HookUtils.m;

(* Change size of posets considered: *)    psiz = 7; 

(* Change input family: *) infam = "StdPsts/stdpsts";
(* Change output family: *) outfam = "StdWPxs/stdwpxs";

stmem = MaxMemoryUsed[]; sttim = AbsoluteTime[]; stcpu = TimeUsed[];

(* Get list of posets of size n. *)
allpsts = ReadList[ StringJoin[infam,ToString[psiz]] ];

ssfil[nn_] := StringJoin["StdIsos/stdisos",ToString[nn]];
mmfil[nn_] := StringJoin["Lookups/lookups",ToString[nn]];
iifil[nn_] := StringJoin["InvExts/invexts",ToString[nn]];
Do[
	<< (ssfil[sz]);
	<< (mmfil[sz]);
	invrsex[sz] = ReadList[iifil[sz]]
,{sz,4,7}];

WriteLstOfLst[
	StringJoin[outfam,ToString[psiz]],
	Map[ WPx[#,InvExtsWRI]&, allpsts ]
];

emem = MaxMemoryUsed[]; etim = AbsoluteTime[]; ecpu = TimeUsed[];
PrntCnsmptn[stmem,emem,sttim,etim,stcpu,ecpu];

(* End of GenWPx.nb. *)