NMath Reference Guide

## Subset Class |

Class Subset represents a collection of indices that can be used to view
a subset of data from another data structure.

Inheritance Hierarchy

Syntax

The Subset type exposes the following members.

Constructors

Name | Description | |
---|---|---|

Subset(Boolean) | Construct a Subset instance from the given array of boolean values. | |

Subset(ICollection) | Constructs a Subset intance from the given collection of integers | |

Subset(Int32) | Constructs a Subset instance with lengthindices starting from 0 with a step size of 1. | |

Subset(Int32) | Construct a Subset instance from the given array of integers. | |

Subset(Subset) | Construct a Subset instance from the given array of Subsets. | |

Subset(Int32, Int32) | Constructs a Subset instance with lengthindices starting from start with a step size of 1. | |

Subset(Int32, Int32, Int32) | Constructs a Subset instance with lengthindices starting from start with a step size of stepSize. |

Properties

Name | Description | |
---|---|---|

First | Gets the first index in the subset. | |

Indices | Gets the underlying array of integer indices. | |

ItemInt32 | Gets and sets the index at the given position. | |

ItemSubset | Gets a subset of this subset. | |

Last | Gets the last index in the subset. | |

Length | Gets the total number of indices in the subset. |

Methods

Name | Description | |
---|---|---|

Add(Subset, Subset) | Adds two subsets. | |

Add(Subset, Int32) | Adds a subset and a scalar. | |

Append | Adds an index to this subset. | |

Clone | Creates a deep copy of this Subset. | |

Decrement | Decrements the indices in a subset. | |

Equals |
Tests for equality of this subset and another subset. Two subsets are equal
if they have the same length and all indices are equal.
(Overrides ObjectEquals(Object)) | |

Get | Safely gets the index at the given position by looping around the end of subset if index exceeds Length. | |

GetEnumerator | Creates an IEnumerator out of the indices in this subset. | |

GetGroupings(Factor) | Returns an array of subsets containing the indices for each level of the given factor. | |

GetGroupings(Factor, Factor) | Returns a two-dimensional jagged array of subsets containing the indices for each combination of levels in the two given factors. | |

GetGroupings(Factor, Factor, Factor) | Returns a two-dimensional jagged array of subsets containing the indices for each combination of levels in the three given factors. | |

GetGroupings(Factor, Factor, Factor, Factor) | Returns a two-dimensional jagged array of subsets containing the indices for each combination of levels in the four given factors. | |

GetHashCode |
Returns an integer hash code for this subset.
(Overrides ObjectGetHashCode) | |

Increment | Increments the indices in a subset. | |

Intersection | Returns the intersection of two subsets. | |

Negate | Negates a subset. | |

Remove | Removes the first occurence of an index from this subset. | |

Repeat | Repeats this subset until the given length is reached. | |

Reverse | Reverse the indices of this subset. | |

Sample(Int32) | Returns a random shuffle of 0...n-1. | |

Sample(Int32, RandGenMTwist) | Returns a random shuffle of 0...n-1. | |

Sample(Int32, Int32) | Returns a random shuffle of 0...n-1 | |

Split(Int32) | Splits this subset into the specified number of equally-sized subsets. | |

Split(Int32, Subset) | Splits this subset into an arbitrary array of subsets. | |

Subtract(Subset, Subset) | Subtracts one subset from another. | |

Subtract(Subset, Int32) | Subtracts a scalar from a subset. | |

ToReverse | Returns a new subset containing the indices of this subset in the reverse order. | |

ToString |
Returns a formatted string representation of this subset.
(Overrides ObjectToString) | |

ToUnique | Returns a new subset containing the sorted indices of this subset, with all repetitions removed. | |

Union | Returns the union of two subsets. | |

Unique | Sorts the indices in this subset and removes any repetitions. |

Operators

Name | Description | |
---|---|---|

Addition(Subset, Subset) | Adds two subsets. | |

Addition(Subset, Int32) | Adds a subset and a scalar. | |

BitwiseAnd(Subset, Subset) | Returns the intersection of two subsets. | |

BitwiseOr(Subset, Subset) | Returns the union of two subsets. | |

Decrement(Subset) | Decrements the indices in this subset. | |

Equality(Subset, Subset) | Tests for equality of two subsets. Two subsets are equal if they have the same length and all indices are equal. | |

(Subset to Int32) | Implicitly converts a subset into an array of integers. | |

Increment(Subset) | Increments the elements in this subset. | |

Inequality(Subset, Subset) | Tests for inequality of two subsets. Two subsets are unequal if they have different lengths or their indices are not all equal. | |

Subtraction(Subset, Subset) | Subtracts one subset from another. | |

Subtraction(Subset, Int32) | Subtracts a scalar from a subset. | |

UnaryNegation(Subset) | Negates the elements in this subset. | |

UnaryPlus(Subset) | Returns a subset. |

Remarks

Unlike a Slice or a Range, a Subset need not be continuous, or even
ordered. It is simply an arbitrary collection of indices.

See Also