Home Online Manual
Top
Back: simplify
Forward: slimgb
FastBack: Functions and system variables
FastForward: Control structures
Up: Functions
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

5.1.136 size

Syntax:
size ( string_expression )
size ( bigint_expression )
size ( number_expression )
size ( intvec_expression )
size ( intmat_expression )
size ( poly_expression )
size ( vector_expression )
size ( ideal_expression )
size ( module_expression )
size ( matrix_expression )
size ( list_expression )
size ( resolution_expression )
size ( ring_expression )
Type:
int
Purpose:
depends on the type of argument:
ideal or module
returns the number of (non-zero) generators.
string, intvec, list or resolution
returns the length, i.e., the number of characters, entries or elements.
poly or vector
returns the number of monomials.
matrix or intmat
returns the number of entries (rows*columns).
ring
returns the number of elements in the ground field (for Z/p and algebraic extensions) or -1
number or bigint
returns 0 for 0 or the number of words
Example:
 
  string s="hello";
  size(s);
==> 5
  intvec iv=1,2;
  size(iv);
==> 2
  ring r=0,(x,y,z),lp;
  poly f=x+y+z;
  size(f);
==> 3
  vector v=[x+y,0,0,1];
  size(v);
==> 3
  ideal i=f,y;
  size(i);
==> 2
  module m=v,[0,1],[0,0,1],2*v;
  size(m);
==> 4
  matrix mm[2][2];
  size(mm);
==> 4
  ring r1=(2,a),x,dp;
  minpoly=a4+a+1;
  size(r1);
==> 16
See ideal; intmat; intvec; module; ncols; nrows; poly; string; vector.