i think something like this may do :
type type4x4 is array(integer range 0 to 3, integer range 0 to 3) of natural;
--
function CreateI return type4x4 is
for i in I'range(1) loop
for j in I'range(2) loop
if (i=j) then
I(i,j) = 1;
else
I(i,j) = 0;
end if;
end loop;
end loop;
---------------------------------------------------
-- the inv function.
----------------------------------------------
function Inv(A : type4x4x) return type4x4 is
variable I : type4x4 := CreateI;
pivot : natural;
begin
for in in A'range(1) loop
pivot = A(i,i);
for j in A'range(2) loop
I(i,i) := I(i.j)/pivot; A(i.j) := A(i.j)/pivot;
end loop;
for k in A'range(1) loop
if ((A(k, i) /= 0) and (k /=i)) then
for j in A'range(2) loop
A(k,j) := A(k,j) - A(i,j)*A(k,j);
end loop;
end if;
end loop;
end loop;
return I;
end function;