Home Online Manual
Top
Back: frandwalk
Forward: set
FastBack:
FastForward:
Up: Singular Manual
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.15.19 sets_lib

Library:
sets.lib
Purpose:
Sets in Singular

Authors:
J. Boehm, boehm @ mathematik.uni-kl.de
D. Wienholz, wienholz @ mathematik.uni-kl.de
S. Zillien, zillien @ rhrk.uni-kl.de

Overview:
We implement the new class set and all basic methods needed to work with sets. A set is generated from a list. After the generating of a set, the adding of an element or the union of two sets, automatically every double element is removed to secure that no element occurs in a set more than once.

There is a comparison operator, we access the operator via the function isEqual. This function isEqual can be used to compare two elements of the same type (Set, list, int, bigint, string, intmat, bigintmat, intvec, ring, map, poly, matrix, ideal, module, vector, resolution) and also works for comparing of int, bigint and number with each other, similarly for matrix, bigintmat and intmat.

The function size can be used to determine the number of elements.

The + operator is used for the union, the * operator for the intersection.

The operators < and > can be used for inclusion tests.

The print function can be used for printing sets.

Note that the implementation of the underlying data structure and algorithms is very trivial and will at some point be replaced with something more efficient.

Types:
Set The class of all sets

Procedures:

D.15.19.1 set  general procedure to generate a set from a list
D.15.19.2 union  union of sets
D.15.19.3 intersectionSet  intersection of sets
D.15.19.4 complement  complement of sets
D.15.19.5 isElement  test whether an object is in a set
D.15.19.6 isSubset  test whether a set is a subset of another set
D.15.19.7 isSuperset  test whether a set is a superset of another set
D.15.19.8 addElement  adds an element to the set