I believe that by "elementary" matrices you mean only those that perform the elementary operations of permuting rows, multiplying rows, and adding rows.
You may be interested to know what is part of the result of the decomposition of PLU (factorization). U arising from the decomposition of the PLU is the result of eliminating Gauss, and that the decomposition of the PLU is just GE in disguise. Both the P and L decompositions of the PLU encode element operations performed to perform GE. And all Maple, Matlab, and Mathematica have a good PLU decomposition procedure. Thus, you can get basic factors.
Suppose now that we do not need to do any summary swaps. So, given the given matrix M, we can get the lower triangular L and the upper triangular M. The entries L lying below the main diagonal are the values with which we can construct elementary row addition matrices.
Maple, , . . , T1, GE, M l1 L PLU M. . u1, U PLU M, M.
T2 GE, u1 ^% T ( U PLU M) . l2 L PLU u1 ^% T.
u2 U PLU u1 ^% T. ( ). , u2.
, . , T2 , , , u1 ^% T. , T3 T1 T2, T3 u2.
, Maple. . , .
, , ( , - , ).
ElemDecomp:=proc(M::Matrix(square))
local p1,u1,i,j,T1,T2,T3,p2,m,n,lu1,lu2,P1,P2;
uses LinearAlgebra;
(m,n):=Dimensions(M);
p1,lu1:=LUDecomposition(M,output=[':-NAG']);
for i from 1 to m-1 do
for j from 1 to i do
if lu1[i+1,j]<>0 then
T1[i*j]:=IdentityMatrix(m,compact=false);
T1[i*j][i+1,j]:=lu1[i+1,j];
end if;
end do; end do;
for i from 1 to m do
if p1[i]<>i then
P1[i]:=IdentityMatrix(m,compact=false);
P1[i][p1[i],i],P1[i][i,p1[i]]:=1,1;
P1[i][p1[i],p1[i]],P1[i][i,i]:=0,0;
end if;
end do;
u1:=Matrix(lu1,shape=triangular[upper]);
p2,lu2:=LUDecomposition(u1^%T,output=[':-NAG']);
for i from 1 to m-1 do
for j from 1 to i do
if lu2[i+1,j]<>0 then
T2[i*j]:=IdentityMatrix(m,compact=false);
T2[i*j][i+1,j]:=lu2[i+1,j];
end if;
end do; end do;
for i from 1 to m do
if lu2[i,i]<>1 then
T3[i]:=IdentityMatrix(m,compact=false);
T3[i][i,i]:=lu2[i,i];
end if;
end do;
for i from 1 to m do
if p2[i]<>i then
P2[i]:=IdentityMatrix(m,compact=false);
P2[i][p2[i],i],P2[i][i,p2[i]]:=1,1;
P2[i][p2[i],p2[i]],P2[i][i,i]:=0,0;
end if;
end do;
`if`(type(P1,table),entries(P1,':-nolist'),NULL),
seq(seq(`if`(assigned(T1[i*j]),T1[i*j],NULL),j=1..i),i=1..m-1),
seq(`if`(assigned(T3[i]),T3[i],NULL),i=1..min(m,n)),
seq(seq(`if`(assigned(T2[i*j]),T2[i*j]^%T,NULL),j=i..1,-1),i=m-1..1,-1),
`if`(type(P2,table),entries(P2,':-nolist'),NULL);
end proc:
A:=LinearAlgebra:-RandomMatrix(3,generator=1..4);
ElemDecomp(A);
LinearAlgebra:-Norm( `.`(%) - A);