File : lass.ads


with Ints, Mods, Sets2, Reps, Lin;
use Ints, Mods, Reps, Lin;

generic

  NumEqu, NumVar: in Integer;

package Lass is        -- using the revised Lassere method to compute polytope volumes

  MinDoTrans: Positive :=  5;      -- min dimension for translations (default)
  MinVolSave: Positive :=  4;      -- min dimension for considering saved volume (default)
  MaxVolSave: Positive := 99;      -- max dimension for using saved volume (default)
  MinVolConv: Positive :=  4;      -- min dimension for converting saved volume (default)

  procedure StorageInfo;
  procedure Vol(A: in out RMatPtr; V: out Rep);  -- volume defined by halfspace constraints A

private

  package LassSets is new Sets2(L_Last => NumEqu);
  use LassSets;

  subtype SSV is S_SetVec(1 .. NumEqu);
  type SSVPtr is access all SSV;
  subtype LSV is L_SetVec(1 .. NumEqu);
  type LSVPtr is access all LSV;

  subtype Qivot is IVec(1 .. NumVar);
  type QivotPtr is access all Qivot;
  subtype Pivot is IVec(1 .. NumEqu);
  type PivotPtr is access all Pivot;
  type Pivots is array(1 .. NumVar) of aliased Pivot;
  type PivotsPtr is access all Pivots;

  subtype Face is RVec(0 .. NumVar);
  type FacePtr is access all Face;
  type Polt is array(1 .. NumEqu) of aliased Face;
  type PoltPtr is access all Polt;
  type Polts is array(1 .. NumVar) of aliased Polt;
  type PoltsPtr is access all Polts;

  subtype Goo is RMat(1 .. NumVar,1 .. NumVar);
  type GooPtr is access all Goo;

  GQiv: QivotPtr;   -- selected constraints
  GPiv: PivotsPtr;  -- selected variables
  GPol: PoltsPtr;   -- constraints
  GNum: PivotsPtr;  -- constraint numbers
  GCol: SSVPtr;     -- variables set to zero
  GRow: LSVPtr;     -- constraints characterizing face
  GMat: GooPtr;     -- matrix used for converting volumes

  procedure AllocGStuff;
  procedure FreeGStuff;
  function FillPivot(M,D: Integer; P: PivotPtr; A: PoltPtr) return Boolean;
  function Ortho(F,T: in FacePtr; H: in PoltPtr; M,D: in Integer) return Integer;
  procedure Translate(M,D: in Integer; P: in PivotPtr; A: in PoltPtr);
  procedure Reduce(M,D,I: in Integer; P: in PivotPtr; A,B: in PoltPtr; Ib: out Integer);
  function Vol1(M: Integer) return Rep;
  function Vol2(M: Integer) return Rep;
  function VolFactor(VarSet: Int) return Rep;
  procedure FindVol(D: in Integer; V: out Rep; Found: out Boolean);
  function Vol(Ma,Da: in Integer) return Rep;

end Lass;