Range Structure

Represents a range of indexes.

Definition

Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
public struct Range : IEnumerable<int>, IEnumerable
Inheritance
Object  →  ValueType  →  Range
Implements
IEnumerable<Int32>, IEnumerable

Remarks

Use a Range structure to represent a range of indexes for a vector or matrix. The range runs from StartIndex to EndIndex with increments of Stride.

StartIndex is guaranteed to be the first index in the range. The last index in the range is the largest number of the form StartIndex + kStride that is less than or equal to EndIndex.

The Stride property can also be negative. In this case, the last index in the range is the smallest number of the form StartIndex + kStride that is greater than or equal to EndIndex.

The special range All can be used to represent a range over an entire row, column, or vector, without having to specify the EndIndex explicitly.

Range objects are immutable. Once created, the start index, end index and stride properties cannot be modified. Instead, create a new Range instance.

Constructors

Range(Int32, Int32) Constructs a new Range.
Range(Int32, Int32, Int32) Constructs a new Range.

Properties

EndIndex Gets the index of the last element in the range.
StartIndex Gets the index of the first element in the range.
Stride Gets the increment for the index.

Methods

Equals Determines whether the specified Object is equal to the current Range.
(Overrides ValueType.Equals(Object))
GetHashCode Returns the hash code for this instance.
(Overrides ValueType.GetHashCode())
GetTypeGets the Type of the current instance.
(Inherited from Object)
ToStringReturns the fully qualified type name of this instance.
(Inherited from ValueType)

Operators

Equality(Range, Range) Returns a value indicating whether two instances of Range are equal.
Inequality(Range, Range) Returns a value indicating whether two instances of Range are different.

Fields

All Represents the range over an entire row, column, or vector.

Extension Methods

Group<Int32> Returns a grouping by the unique elements in a sequence.
(Defined by Grouping)
Group<Int32> Returns a grouping by the unique elements in a sequence using the specified comparer to determine equality.
(Defined by Grouping)
Sum<Int32> Computes the sum of the sequence of values.
(Defined by ArrayMath)
Sum<Int32, U> Computes the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence.
(Defined by ArrayMath)

See Also