Click or drag to resize

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
SystemObject
  CenterSpace.NMath.CoreSubset

Namespace:  CenterSpace.NMath.Core
Assembly:  NMath (in NMath.dll) Version: 7.4
Syntax
[SerializableAttribute]
public class Subset : IEnumerable, ICloneable

The Subset type exposes the following members.

Constructors
  NameDescription
Public methodSubset(Boolean)
Construct a Subset instance from the given array of boolean values.
Public methodSubset(ICollection)
Constructs a Subset intance from the given collection of integers
Public methodSubset(Int32)
Constructs a Subset instance with lengthindices starting from 0 with a step size of 1.
Public methodSubset(Int32)
Construct a Subset instance from the given array of integers.
Public methodSubset(Subset)
Construct a Subset instance from the given array of Subsets.
Public methodSubset(Int32, Int32)
Constructs a Subset instance with lengthindices starting from start with a step size of 1.
Public methodSubset(Int32, Int32, Int32)
Constructs a Subset instance with lengthindices starting from start with a step size of stepSize.
Top
Properties
  NameDescription
Public propertyFirst
Gets the first index in the subset.
Public propertyIndices
Gets the underlying array of integer indices.
Public propertyItemInt32
Gets and sets the index at the given position.
Public propertyItemSubset
Gets a subset of this subset.
Public propertyLast
Gets the last index in the subset.
Public propertyLength
Gets the total number of indices in the subset.
Top
Methods
  NameDescription
Public methodStatic memberAdd(Subset, Subset)
Adds two subsets.
Public methodStatic memberAdd(Subset, Int32)
Adds a subset and a scalar.
Public methodAppend
Adds an index to this subset.
Public methodClone
Creates a deep copy of this Subset.
Public methodStatic memberDecrement
Decrements the indices in a subset.
Public methodEquals
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).)
Public methodGet
Safely gets the index at the given position by looping around the end of subset if index exceeds Length.
Public methodGetEnumerator
Creates an IEnumerator out of the indices in this subset.
Public methodStatic memberGetGroupings(Factor)
Returns an array of subsets containing the indices for each level of the given factor.
Public methodStatic memberGetGroupings(Factor, Factor)
Returns a two-dimensional jagged array of subsets containing the indices for each combination of levels in the two given factors.
Public methodStatic memberGetGroupings(Factor, Factor, Factor)
Returns a two-dimensional jagged array of subsets containing the indices for each combination of levels in the three given factors.
Public methodStatic memberGetGroupings(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.
Public methodGetHashCode
Returns an integer hash code for this subset.
(Overrides ObjectGetHashCode.)
Public methodStatic memberIncrement
Increments the indices in a subset.
Public methodStatic memberIntersection
Returns the intersection of two subsets.
Public methodStatic memberNegate
Negates a subset.
Public methodRemove
Removes the first occurence of an index from this subset.
Public methodRepeat
Repeats this subset until the given length is reached.
Public methodReverse
Reverse the indices of this subset.
Public methodStatic memberSample(Int32)
Returns a random shuffle of 0...n-1.
Public methodStatic memberSample(Int32, RandGenMTwist)
Returns a random shuffle of 0...n-1.
Public methodStatic memberSample(Int32, Int32)
Returns a random shuffle of 0...n-1
Public methodSplit(Int32)
Splits this subset into the specified number of equally-sized subsets.
Public methodCode exampleSplit(Int32, Subset)
Splits this subset into an arbitrary array of subsets.
Public methodStatic memberSubtract(Subset, Subset)
Subtracts one subset from another.
Public methodStatic memberSubtract(Subset, Int32)
Subtracts a scalar from a subset.
Public methodToReverse
Returns a new subset containing the indices of this subset in the reverse order.
Public methodToString
Returns a formatted string representation of this subset.
(Overrides ObjectToString.)
Public methodToUnique
Returns a new subset containing the sorted indices of this subset, with all repetitions removed.
Public methodStatic memberUnion
Returns the union of two subsets.
Public methodUnique
Sorts the indices in this subset and removes any repetitions.
Top
Operators
  NameDescription
Public operatorStatic memberAddition(Subset, Subset)
Adds two subsets.
Public operatorStatic memberAddition(Subset, Int32)
Adds a subset and a scalar.
Public operatorStatic memberBitwiseAnd
Returns the intersection of two subsets.
Public operatorStatic memberBitwiseOr
Returns the union of two subsets.
Public operatorStatic memberDecrement
Decrements the indices in this subset.
Public operatorStatic memberEquality
Tests for equality of two subsets. Two subsets are equal if they have the same length and all indices are equal.
Public operatorStatic member(Subset to Int32)
Implicitly converts a subset into an array of integers.
Public operatorStatic memberIncrement
Increments the elements in this subset.
Public operatorStatic memberInequality
Tests for inequality of two subsets. Two subsets are unequal if they have different lengths or their indices are not all equal.
Public operatorStatic memberSubtraction(Subset, Subset)
Subtracts one subset from another.
Public operatorStatic memberSubtraction(Subset, Int32)
Subtracts a scalar from a subset.
Public operatorStatic memberUnaryNegation
Negates the elements in this subset.
Public operatorStatic memberUnaryPlus
Returns a subset.
Top
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