up previous next
NumCompts

the number of components

Syntax
NumCompts(X: MODULEELEM|MODULE): INT

Description
If X is a MODULEELEM , it returns the number of components of X . If X is a MODULE , it returns the rank of the free module in which X is defined.

This function used to be called NumComps in CoCoA-4.

Example
/**/  Use R ::= QQ[x,y];
/**/  R2 := NewFreeModule(R, 3);
/**/  M := SubmoduleRows(R2, matrix(R, mat([[x,0,y], [x^2+y^2,x^2,3]])));
/**/  NumCompts(M);
3
/**/  NumCompts(gens(M)[1]);
3

See Also