Class IntSet
java.lang.Object
smile.util.IntSet
- All Implemented Interfaces:
Serializable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintindexOf(int value) Maps the value to index.static IntSetof(int k) Returns the IntSet of [0, k).static IntSetof(int[] samples) Finds the unique values from samples.intsize()Returns the number of values.intvalueOf(int index) Maps an index to the corresponding value.
-
Field Details
-
values
public final int[] valuesMap of index to original values. -
index
-
min
public final int minThe minimum of values. -
max
public final int maxThe maximum of values.
-
-
Constructor Details
-
IntSet
public IntSet(int[] values) Constructor.- Parameters:
values- the unique values.
-
-
Method Details
-
size
public int size()Returns the number of values.- Returns:
- the number of values.
-
valueOf
public int valueOf(int index) Maps an index to the corresponding value.- Parameters:
index- the index.- Returns:
- the value.
-
indexOf
public int indexOf(int value) Maps the value to index.- Parameters:
value- the value.- Returns:
- the index.
-
of
Returns the IntSet of [0, k).- Parameters:
k- the number of unique values.- Returns:
- the set.
-
of
Finds the unique values from samples.- Parameters:
samples- the samples.- Returns:
- the set.
-