# calculates the exponentsvectors of the fractional ideals
# generated by elms corresponding to the prime ideals 
# arrissing in the factorization

o  := OrderMaximal( f );
oe := OrderEquationOrder( o );
os := OrderShort(o); 
if os = false then os:=o; fi;
os := OrderSimplify(OrderLLL(os)); 


# Express the elements in elms in terms of the maximalorder
a:=[];
for i in [1..Length(elms)] do
    b := Elt( oe, elms[i] );
    c := EltMove( b, os );
    #c := EltUnitDecompose( b, "expons" );
    #AppendTo(outt,c,",\n");
    Add(a,c);
od;


# factorize all ideals generated by the elements of a and collect all
# primideals which occur
primId:=[];
for i in [1..Length(a)] do
    factor:=Factor(a[i]*os);
    for j in [1..Length(factor)] do
        if not factor[j][1] in primId then
            Add(primId,factor[j][1]);
        fi;
    od;
od;

# write for every element in a the exponentfactor corresponding to the
# ideals in primId in a row
# so we will have a martix #columns = Length(primId) and
#                          #rows = Length(a)
matrix:=[];
if Length( primId ) <> 0 then
    for i in [1..Length(a)] do
        Add(matrix,[]);
    od;
    for i in [1..Length(a)] do
        for j in [1..Length(primId)] do
            matrix[i][j]:=IdealValuation(primId[j],a[i]*os);
        od;
    od;
fi;

# write the matrix in a file
PrintTo(outt," KANTVars :=  \n",matrix,";\n");








