This class implements the data structure and methods for fuzzy sets.
new()
Creator for objects of class SparseSet
SparseSet$new(attributes, M = NULL)
attributes
(character vector) Names of the attributes that will be available in the fuzzy set.
M
(numeric vector or column Matrix
) Values (grades) to be assigned to the attributes.
If M
is omitted, the fuzzy set is the empty set. Later, one can use the assign
method to assign grades to any of its attributes.
An object of class SparseSet
.
assign()
Assign grades to attributes in the set
SparseSet$assign(attributes = c(), values = c(), ...)
attributes
(character vector) Names of the attributes to assign a grade to.
values
(numeric vector) Grades to be assigned to the previous attributes
.
...
key
= value
pairs, where the value value
is assigned to the key
attribute name.
One can use both of:
S$assign(A = 1, B = 0.3)
S$assign(attributes = c(A, B), values = c(1, 0.3))
.
[()
Get elements by index
SparseSet$[(indices)
indices
(numeric, logical or character vector) The indices of the elements to return. It can be a vector of logicals where TRUE
elements are to be retained.
A SparseSet
but with only the required elements.
cardinal()
Cardinal of the SparseSet
SparseSet$cardinal()
the cardinal of the SparseSet
, counted
as the sum of the degrees of each element.
get_vector()
Internal Matrix
SparseSet$get_vector()
The internal sparse Matrix
representation of the set.
get_attributes()
Attributes defined for the set
SparseSet$get_attributes()
A character vector with the names of the attributes.
length()
Number of attributes
SparseSet$length()
The number of attributes that are defined for this fuzzy set.
print()
Prints the set to console
SparseSet$print()
A string with the elements of the set and their grades between brackets .
to_latex()
Write the set in LaTeX format
SparseSet$to_latex(print = TRUE)
print
(logical) Print to output?
The fuzzy set in LaTeX.
clone()
The objects of this class are cloneable with this method.
SparseSet$clone(deep = FALSE)
deep
Whether to make a deep clone.
1 2 3 4 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.