closure {sets}R Documentation

Closure and reduction

Description

Closure and reduction of (g)sets.

Usage

## S3 method for class 'set'
closure(x, operation = c("union", "intersection"), ...)
binary_closure(x, operation = c("union", "intersection"))
## S3 method for class 'set'
reduction(x, operation = c("union", "intersection"), ...)
binary_reduction(x, operation = c("union", "intersection"))

Arguments

x

For binary_closure and binary_reduction: a binary matrix. A set of (g)sets otherwise.

operation

The set operation under which the closure or reduction shall be computed.

...

Currently not used.

Details

The closure of a set SS under some operation OPOP contains all elements of SS, and the results of OPOP applied to all element pairs of SS.

The reduction of a set SS under some operation OPOP is the minimal subset of SS having the same closure than SS under OPOP.

Note that the closure and reduction methods for sets are currently only implemented for sets of (g)sets (families) and will give an error for other cases.

binary_closure and binary_reduction interface efficient C code for computing closures and reductions of binary patterns. They are used by the high-level methods if x contains only objects of class sets.

Value

An object of same type than x.

Author(s)

The C code for binary closures is provided by Christian Buchta.

See Also

set, gset.

Examples

## ordinary set
s <- set(set(1),set(2),set(3))
(cl <- closure(s))
(re <- reduction(cl))
stopifnot(s == re)

(cl <- closure(s, "intersection"))
(re <- reduction(cl, "intersection"))
stopifnot(s == re)

## multi set
s <- set(gset(1,1),gset(2,2),gset(3,3))
(cl <- closure(s))
(re <- reduction(cl))
stopifnot(s == re)

## fuzzy set
s <- set(gset(1,1/3),gset(2,2/3),gset(3,3/3))
(cl <- closure(s))
(re <- reduction(cl))
stopifnot(s == re)

## fuzzy multiset
s <- set(gset(1,list(set(1,0.8))), gset(2, list(gset(1,3))), gset(3,0.3))
(cl <- closure(s))
(re <- reduction(cl))
stopifnot(s == re)

[Package sets version 1.0-25 Index]