package body Lin is
function Length(W: in Sparse) return Integer is
begin
return W(0).I;
end Length;
procedure SetZero(W: out Sparse) is
begin
W(0) := (0,0,Zero);
end SetZero;
procedure AddComponent(U: in Trip; W: in out Sparse; Cut: in Rep := Zero) is
L: Natural;
begin
if Abs(U.R)>Cut then
L := W(0).I+1;
if L>W'Last then
raise Matrix_Full;
end if;
W(L) := U;
W(0).I := L; -- new length of W
W(0).J := 1; -- may need cleanup
end if;
end AddComponent;
end Lin;