|  |  D.2.8.4 freerank Procedure from librarypoly.lib(see  poly_lib).
 
Example:Usage:
freerank(M[,any]); M=poly/ideal/vector/module/matrix
Compute:
rank of module presented by M in case it is free.
By definition this is vdim(coker(M)/m*coker(M)) if coker(M)
is free, where m is the maximal ideal of the variables of the
basering and M is considered to be a matrix.
 (the 0-module is free of rank 0)
 
Return:
rank of coker(M) if coker(M) is free and -1 else;
in case of a second argument return a list:
 L[1] = rank of coker(M) or -1
 L[2] = minbase(M)
 
Note:
freerank(syz(M)); computes the rank of M if M is free (and -1 else)
 |  | LIB "poly.lib";
ring r;
ideal i=x;
module M=[x,0,1],[-x,0,-1];
freerank(M);          // should be 2, coker(M) is not free
==> 2
freerank(syz (M),"");
==> [1]:
==>    1
==> [2]:
==>    _[1]=gen(2)+gen(1)
// [1] should be 1, coker(syz(M))=M is free of rank 1
// [2] should be gen(2)+gen(1) (minimal relation of M)
freerank(i);
==> -1
freerank(syz(i));     // should be 1, coker(syz(i))=i is free of rank 1
==> 1
 | 
 
 |