|
D.4.2.12 nonZeroEntry
Procedure from library algebra.lib (see algebra_lib).
- Usage:
- nonZeroEntry(id); id=object for which the test 'id[i]!=0', i=1,..,N,
N=size(id) (resp. ncols(id) for id of type ideal or module)
is defined (e.g. ideal, vector, list of polynomials, intvec,...)
- Return:
| a list, say l, with l[1] an integer, l[2], l[3] integer vectors:
- l[1] number of non-zero entries of id
- l[2] intvec of size l[1] with l[2][i]=i if id[i] != 0
in case l[1]!=0 (and l[2]=0 if l[1]=0)
- l[3] intvec with l[3][i]=1 if id[i]!=0 and l[3][i]=0 else
|
- Note:
Example:
| LIB "algebra.lib";
ring r = 0,(a,b,c),dp;
poly f = a3c+b3+c2+a;
intvec v = leadexp(f);
nonZeroEntry(v);
==> [1]:
==> 2
==> [2]:
==> 1,3
==> [3]:
==> 1,0,1
intvec w;
list L = 37,0,f,v,w;
nonZeroEntry(L);
==> [1]:
==> 3
==> [2]:
==> 1,3,4
==> [3]:
==> 1,0,1,1,0
|
|