Procedure from library general.lib (see general_lib).
Usage:
sum(id[,v]); id ideal/vector/module/matrix/intvec/intmat/list,
v intvec (default: v=1..number of entries of id)
Assume:
list members can be added.
Return:
The sum of all entries of id [with index given by v] of type
depending on the entries of id.
Note:
If id is not a list, id is treated as a list of polys resp. integers.
A module m is identified with the corresponding matrix M (columns
of M generate m).
If v is outside the range of id, we have the empty sum and the
result will be 0 (of type int).