Click or drag to resize
Accord.NET (logo)

Range Structure

Represents a double range with minimum and maximum values, where values are single-precision floating-point (float) numbers.

Namespace:  Accord
Assembly:  Accord (in Accord.dll) Version: 3.8.0
Syntax
[SerializableAttribute]
public struct Range : IRange<float>, 
	IFormattable, IEquatable<Range>
Request Example View Source

The Range type exposes the following members.

Constructors
  NameDescription
Public methodRange
Initializes a new instance of the Range class.
Top
Properties
  NameDescription
Public propertyLength
Gets the length of the range, defined as (max - min).
Public propertyMax
Maximum value of the range.
Public propertyMin
Minimum value of the range.
Top
Methods
  NameDescription
Public methodEquals(Object)
Determines whether the specified Object, is equal to this instance.
(Overrides ValueTypeEquals(Object).)
Public methodEquals(Range)
Indicates whether the current object is equal to another object of the same type.
Public methodGetHashCode
Returns a hash code for this instance.
(Overrides ValueTypeGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIntersection
Computes the intersection between two ranges.
Public methodIsInside(Single)
Check if the specified value is inside of the range.
Public methodIsInside(Range)
Check if the specified range is inside of the range.
Public methodIsOverlapping
Check if the specified range overlaps with the range.
Public methodToIntRange
Converts this single-precision range into an IntRange.
Public methodToString
Returns a String that represents this instance.
(Overrides ValueTypeToString.)
Public methodToString(String, IFormatProvider)
Returns a String that represents this instance.
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Determines whether two instances are equal.
Public operatorStatic member(Range to DoubleRange)
Performs an implicit conversion from IntRange to DoubleRange.
Public operatorStatic memberInequality
Determines whether two instances are not equal.
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodInterval(Int32)Overloaded.
Creates an interval vector (like NumPy's linspace function).
(Defined by Vector.)
Public Extension MethodInterval(Double)Overloaded.
Obsolete. Please use Vector.Range(range, stepSize) instead.
(Defined by Vector.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodRangeOverloaded.
Creates a range vector (like NumPy's arange function).
(Defined by Vector.)
Public Extension MethodRange(Double)Overloaded.
Creates a range vector (like NumPy's arange function).
(Defined by Vector.)
Public Extension MethodRange(Single)Overloaded.
Creates a range vector (like NumPy's arange function).
(Defined by Vector.)
Public Extension MethodRange(Byte)Overloaded.
Creates a range vector (like NumPy's arange function).
(Defined by Vector.)
Public Extension MethodRange(Int32)Overloaded.
Creates a range vector (like NumPy's arange function).
(Defined by Vector.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks
This class represents a double range with inclusive limits, where both minimum and maximum values of the range are included into it. Mathematical notation of such range is [min, max].
Examples
// create [0.25, 1.5] range
var range1 = new SingleRange(0.25f, 1.5f);

// create [1.00, 2.25] range
var range2 = new SingleRange(1.00f, 2.25f);

// check if values is inside of the first range
if (range1.IsInside(0.75f))
{
    // ...
}

// check if the second range is inside of the first range
if (range1.IsInside(range2))
{
    // ...
}

// check if two ranges overlap
if (range1.IsOverlapping(range2))
{
    // ...
}
See Also