File : reps.adb
package body Reps is
function RMin(R1,R2,R3: Rep) return Rep is
begin
return RMin(Rmin(R1,R2),R3);
end RMin;
function RMax(R1,R2,R3: Rep) return Rep is
begin
return RMax(Rmin(R1,R2),R3);
end RMax;
procedure Fill(R: in Rep; V: out RepVector) is
begin
for I in V'Range loop
V(I) := R;
end loop;
end Fill;
function ZeroRepVec(N: in Natural) return RepVector is
V: RepVector(0..N);
begin
Fill(Zero,V);
return V;
end ZeroRepVec;
procedure Fill(R: in Rep; M: out RepMatrix) is
begin
for I in M'Range(1) loop
for J in M'Range(2) loop
M(I,J) := R;
end loop;
end loop;
end Fill;
function ZeroRepMat(N: in Natural) return RepMatrix is
M: RepMatrix(0..N,0..N);
begin
Fill(Zero,M);
return M;
end ZeroRepMat;
function Min(R1,R2: RadPair) return RadPair is
begin
return (RMin(R1(1),R2(1)),RMin(R1(2),R2(2)));
end Min;
function Between(R1,R2: RadPair; S: Rep := Half) return RadPair is
--- no claim of accuracy
R: RadPair;
begin
R(1) := (One-S)*R1(1)+S*R2(1);
R(2) := (One-S)*R1(2)+S*R2(2);
return R;
end Between;
end Reps;