|
D.4.4.2 belongSemigroup
Procedure from library cisimplicial.lib (see cisimplicial_lib).
- Usage:
- belongSemigroup(v,A[,k]); v is an integral vector, A is an
integral matrix, n is a positive integer.
- Return:
- counters, a vector with nonnegative entries such that
A*counters = v. If it does not exist such a vector, it returns 0.
If a third parameter k is introduced, it will only consider the
first k columns of A.
- Assume:
- A is a matrix with nonnegative entries, nonzero columns,
v is a nonnegative vector and nrows(v) = nrows(A).
Example:
| LIB "cisimplicial.lib";
intmat A[3][4] = 10,3,2,1,2,1,1,3,5,0,1,2;
print(A);
==> 10 3 2 1
==> 2 1 1 3
==> 5 0 1 2
intvec v = 23,12,10;
belongSemigroup(v,A);
==> 1,3,1,2
"// A * (1,3,1,2) = v";
==> // A * (1,3,1,2) = v
belongSemigroup(v,A,3);
==> 0
"// v is not a combination of the first 3 columns of A";
==> // v is not a combination of the first 3 columns of A
intvec w = 12,4,1;
belongSemigroup(w,A);
==> 0
"// w is not a combination of the columns of A";
==> // w is not a combination of the columns of A
|
|