closure: Closure and reduction

View source: R/closure.R

closureR 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 S under some operation OP contains all elements of S, and the results of OP applied to all element pairs of S.

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

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)

sets documentation built on May 29, 2024, 10:09 a.m.