Compare.SequenceAlmostEqualRelative Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.6

Overload List

SequenceAlmostEqualRelative<T>(T[], T, Boolean, Boolean, Boolean) Returns whether the values in the specified array are all close to the reference value within the default relative tolerance.
SequenceAlmostEqualRelative<T>(T[], T[], Boolean, Boolean, Boolean) Returns whether the specified values in the arrays are close to each other within the default relative tolerance.
SequenceAlmostEqualRelative<T>(IEnumerable<T>, T, Boolean, Boolean, Boolean) Returns whether the values in the specified sequence are all close to the reference value within the default relative tolerance.
SequenceAlmostEqualRelative<T>(IEnumerable<T>, IEnumerable<T>, Boolean, Boolean, Boolean) Returns whether the specified values in the sequences are close to each other within the default relative tolerance.
SequenceAlmostEqualRelative<T>(ReadOnlySpan<T>, T, Boolean, Boolean, Boolean) Returns whether the values in the specified span are all close to the reference value within the default relative tolerance.
SequenceAlmostEqualRelative<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, Boolean, Boolean, Boolean) Returns whether the specified values in the spans are close to each other within the default relative tolerance.
SequenceAlmostEqualRelative<T>(T[], T, T, Boolean, Boolean, Boolean) Returns whether the values in the specified array are all close to the reference value within the given relative tolerance.
SequenceAlmostEqualRelative<T>(T[], T[], T, Boolean, Boolean, Boolean) Returns whether the specified values in the arrays are close to each other within the given relative tolerance.
SequenceAlmostEqualRelative<T>(IEnumerable<T>, T, T, Boolean, Boolean, Boolean) Returns whether the values in the specified sequence are all close to the reference value within the given relative tolerance.
SequenceAlmostEqualRelative<T>(IEnumerable<T>, IEnumerable<T>, T, Boolean, Boolean, Boolean) Returns whether the specified values in the sequences are close to each other within the given relative tolerance.
SequenceAlmostEqualRelative<T>(ReadOnlySpan<T>, T, T, Boolean, Boolean, Boolean) Returns whether the values in the specified span are all close to the reference value within the given relative tolerance.
SequenceAlmostEqualRelative<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, T, Boolean, Boolean, Boolean) Returns whether the specified values in the spans are close to each other within the given relative tolerance.

SequenceAlmostEqualRelative<T>(T[], T, Boolean, Boolean, Boolean)

Returns whether the values in the specified array are all close to the reference value within the default relative tolerance.
C#
public static bool SequenceAlmostEqualRelative<T>(
	this T[] values,
	T referenceValue,
	bool equalNaN = false,
	bool equalInfinity = true,
	bool symmetric = false
)
where T : Object, IComparable<T>

Parameters

values  T[]
The array of values to compare.
referenceValue  T
The reference value to compare against.
equalNaN  Boolean  (Optional)
Optional. Specifies whether NaN values are considered equal. The default is false.
equalInfinity  Boolean  (Optional)
Optional. Specifies whether infinite values with the same sign are considered equal. The default is true.
symmetric  Boolean  (Optional)
Optional. If false (the default), the elements of referenceValue is used as the reference value. If true, the value with the largest magnitude is used as the reference value.

Type Parameters

T
The type of the values to compare.

Return Value

Boolean
true if all values are close; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type T[]. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

SequenceAlmostEqualRelative<T>(T[], T[], Boolean, Boolean, Boolean)

Returns whether the specified values in the arrays are close to each other within the default relative tolerance.
C#
public static bool SequenceAlmostEqualRelative<T>(
	this T[] values,
	T[] referenceValues,
	bool equalNaN = false,
	bool equalInfinity = true,
	bool symmetric = false
)
where T : Object, IComparable<T>

Parameters

values  T[]
The array of values to compare.
referenceValues  T[]
The array of reference values to compare against.
equalNaN  Boolean  (Optional)
Optional. Specifies whether NaN values are considered equal. The default is false.
equalInfinity  Boolean  (Optional)
Optional. Specifies whether infinite values with the same sign are considered equal. The default is true.
symmetric  Boolean  (Optional)
Optional. If false (the default), the elements of referenceValues are used as the reference value. If true, the value with the largest magnitude is used as the reference value.

Type Parameters

T
The type of the values to compare.

Return Value

Boolean
true if all values are close; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type T[]. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

SequenceAlmostEqualRelative<T>(IEnumerable<T>, T, Boolean, Boolean, Boolean)

Returns whether the values in the specified sequence are all close to the reference value within the default relative tolerance.
C#
public static bool SequenceAlmostEqualRelative<T>(
	this IEnumerable<T> values,
	T referenceValue,
	bool equalNaN = false,
	bool equalInfinity = true,
	bool symmetric = false
)
where T : Object, IComparable<T>

Parameters

values  IEnumerable<T>
The sequence of values to compare.
referenceValue  T
The reference value to compare against.
equalNaN  Boolean  (Optional)
Optional. Specifies whether NaN values are considered equal. The default is false.
equalInfinity  Boolean  (Optional)
Optional. Specifies whether infinite values with the same sign are considered equal. The default is true.
symmetric  Boolean  (Optional)
Optional. If false (the default), the elements of referenceValue is used as the reference value. If true, the value with the largest magnitude is used as the reference value.

Type Parameters

T
The type of the values to compare.

Return Value

Boolean
true if all values are close; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

SequenceAlmostEqualRelative<T>(IEnumerable<T>, IEnumerable<T>, Boolean, Boolean, Boolean)

Returns whether the specified values in the sequences are close to each other within the default relative tolerance.
C#
public static bool SequenceAlmostEqualRelative<T>(
	this IEnumerable<T> values,
	IEnumerable<T> referenceValues,
	bool equalNaN = false,
	bool equalInfinity = true,
	bool symmetric = false
)
where T : Object, IComparable<T>

Parameters

values  IEnumerable<T>
The sequence of values to compare.
referenceValues  IEnumerable<T>
The sequence of reference values to compare against.
equalNaN  Boolean  (Optional)
Optional. Specifies whether NaN values are considered equal. The default is false.
equalInfinity  Boolean  (Optional)
Optional. Specifies whether infinite values with the same sign are considered equal. The default is true.
symmetric  Boolean  (Optional)
Optional. If false (the default), the elements of referenceValues are used as the reference value. If true, the value with the largest magnitude is used as the reference value.

Type Parameters

T
The type of the values to compare.

Return Value

Boolean
true if all values are close; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

SequenceAlmostEqualRelative<T>(ReadOnlySpan<T>, T, Boolean, Boolean, Boolean)

Returns whether the values in the specified span are all close to the reference value within the default relative tolerance.
C#
public static bool SequenceAlmostEqualRelative<T>(
	this ReadOnlySpan<T> values,
	T referenceValue,
	bool equalNaN = false,
	bool equalInfinity = true,
	bool symmetric = false
)
where T : Object, IComparable<T>

Parameters

values  ReadOnlySpan<T>
The span of values to compare.
referenceValue  T
The reference value to compare against.
equalNaN  Boolean  (Optional)
Optional. Specifies whether NaN values are considered equal. The default is false.
equalInfinity  Boolean  (Optional)
Optional. Specifies whether infinite values with the same sign are considered equal. The default is true.
symmetric  Boolean  (Optional)
Optional. If false (the default), referenceValue is used as the reference value. If true, the value with the largest magnitude is used as the reference value.

Type Parameters

T
The type of the values to compare.

Return Value

Boolean
true if all values are close; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ReadOnlySpan<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

SequenceAlmostEqualRelative<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, Boolean, Boolean, Boolean)

Returns whether the specified values in the spans are close to each other within the default relative tolerance.
C#
public static bool SequenceAlmostEqualRelative<T>(
	this ReadOnlySpan<T> values,
	ReadOnlySpan<T> referenceValues,
	bool equalNaN = false,
	bool equalInfinity = true,
	bool symmetric = false
)
where T : Object, IComparable<T>

Parameters

values  ReadOnlySpan<T>
The span of values to compare.
referenceValues  ReadOnlySpan<T>
The span of reference values to compare against.
equalNaN  Boolean  (Optional)
Optional. Specifies whether NaN values are considered equal. The default is false.
equalInfinity  Boolean  (Optional)
Optional. Specifies whether infinite values with the same sign are considered equal. The default is true.
symmetric  Boolean  (Optional)
Optional. If false (the default), the elements of referenceValues are used as the reference value. If true, the value with the largest magnitude is used as the reference value.

Type Parameters

T
The type of the values to compare.

Return Value

Boolean
true if all values are close; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ReadOnlySpan<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

SequenceAlmostEqualRelative<T>(T[], T, T, Boolean, Boolean, Boolean)

Returns whether the values in the specified array are all close to the reference value within the given relative tolerance.
C#
public static bool SequenceAlmostEqualRelative<T>(
	this T[] values,
	T referenceValue,
	T relativeTolerance,
	bool equalNaN = false,
	bool equalInfinity = true,
	bool symmetric = false
)
where T : Object, IComparable<T>

Parameters

values  T[]
The array of values to compare.
referenceValue  T
The reference value to compare against.
relativeTolerance  T
Optional. The relative tolerance.
equalNaN  Boolean  (Optional)
Optional. Specifies whether NaN values are considered equal. The default is false.
equalInfinity  Boolean  (Optional)
Optional. Specifies whether infinite values with the same sign are considered equal. The default is true.
symmetric  Boolean  (Optional)
Optional. If false (the default), the elements of referenceValue is used as the reference value. If true, the value with the largest magnitude is used as the reference value.

Type Parameters

T
The type of the values to compare.

Return Value

Boolean
true if all values are close; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type T[]. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

SequenceAlmostEqualRelative<T>(T[], T[], T, Boolean, Boolean, Boolean)

Returns whether the specified values in the arrays are close to each other within the given relative tolerance.
C#
public static bool SequenceAlmostEqualRelative<T>(
	this T[] values,
	T[] referenceValues,
	T relativeTolerance,
	bool equalNaN = false,
	bool equalInfinity = true,
	bool symmetric = false
)
where T : Object, IComparable<T>

Parameters

values  T[]
The array of values to compare.
referenceValues  T[]
The array of reference values to compare against.
relativeTolerance  T
Optional. The relative tolerance.
equalNaN  Boolean  (Optional)
Optional. Specifies whether NaN values are considered equal. The default is false.
equalInfinity  Boolean  (Optional)
Optional. Specifies whether infinite values with the same sign are considered equal. The default is true.
symmetric  Boolean  (Optional)
Optional. If false (the default), the elements of referenceValues are used as the reference value. If true, the value with the largest magnitude is used as the reference value.

Type Parameters

T
The type of the values to compare.

Return Value

Boolean
true if all values are close; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type T[]. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

SequenceAlmostEqualRelative<T>(IEnumerable<T>, T, T, Boolean, Boolean, Boolean)

Returns whether the values in the specified sequence are all close to the reference value within the given relative tolerance.
C#
public static bool SequenceAlmostEqualRelative<T>(
	this IEnumerable<T> values,
	T referenceValue,
	T relativeTolerance,
	bool equalNaN = false,
	bool equalInfinity = true,
	bool symmetric = false
)
where T : Object, IComparable<T>

Parameters

values  IEnumerable<T>
The sequence of values to compare.
referenceValue  T
The reference value to compare against.
relativeTolerance  T
Optional. The relative tolerance.
equalNaN  Boolean  (Optional)
Optional. Specifies whether NaN values are considered equal. The default is false.
equalInfinity  Boolean  (Optional)
Optional. Specifies whether infinite values with the same sign are considered equal. The default is true.
symmetric  Boolean  (Optional)
Optional. If false (the default), the elements of referenceValue is used as the reference value. If true, the value with the largest magnitude is used as the reference value.

Type Parameters

T
The type of the values to compare.

Return Value

Boolean
true if all values are close; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

SequenceAlmostEqualRelative<T>(IEnumerable<T>, IEnumerable<T>, T, Boolean, Boolean, Boolean)

Returns whether the specified values in the sequences are close to each other within the given relative tolerance.
C#
public static bool SequenceAlmostEqualRelative<T>(
	this IEnumerable<T> values,
	IEnumerable<T> referenceValues,
	T relativeTolerance,
	bool equalNaN = false,
	bool equalInfinity = true,
	bool symmetric = false
)
where T : Object, IComparable<T>

Parameters

values  IEnumerable<T>
The sequence of values to compare.
referenceValues  IEnumerable<T>
The sequence of reference values to compare against.
relativeTolerance  T
Optional. The relative tolerance.
equalNaN  Boolean  (Optional)
Optional. Specifies whether NaN values are considered equal. The default is false.
equalInfinity  Boolean  (Optional)
Optional. Specifies whether infinite values with the same sign are considered equal. The default is true.
symmetric  Boolean  (Optional)
Optional. If false (the default), the elements of referenceValues are used as the reference value. If true, the value with the largest magnitude is used as the reference value.

Type Parameters

T
The type of the values to compare.

Return Value

Boolean
true if all values are close; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

SequenceAlmostEqualRelative<T>(ReadOnlySpan<T>, T, T, Boolean, Boolean, Boolean)

Returns whether the values in the specified span are all close to the reference value within the given relative tolerance.
C#
public static bool SequenceAlmostEqualRelative<T>(
	this ReadOnlySpan<T> values,
	T referenceValue,
	T relativeTolerance,
	bool equalNaN = false,
	bool equalInfinity = true,
	bool symmetric = false
)
where T : Object, IComparable<T>

Parameters

values  ReadOnlySpan<T>
The span of values to compare.
referenceValue  T
The reference value to compare against.
relativeTolerance  T
Optional. The relative tolerance.
equalNaN  Boolean  (Optional)
Optional. Specifies whether NaN values are considered equal. The default is false.
equalInfinity  Boolean  (Optional)
Optional. Specifies whether infinite values with the same sign are considered equal. The default is true.
symmetric  Boolean  (Optional)
Optional. If false (the default), referenceValue is used as the reference value. If true, the value with the largest magnitude is used as the reference value.

Type Parameters

T
The type of the values to compare.

Return Value

Boolean
true if all values are close; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ReadOnlySpan<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

SequenceAlmostEqualRelative<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, T, Boolean, Boolean, Boolean)

Returns whether the specified values in the spans are close to each other within the given relative tolerance.
C#
public static bool SequenceAlmostEqualRelative<T>(
	this ReadOnlySpan<T> values,
	ReadOnlySpan<T> referenceValues,
	T relativeTolerance,
	bool equalNaN = false,
	bool equalInfinity = true,
	bool symmetric = false
)
where T : Object, IComparable<T>

Parameters

values  ReadOnlySpan<T>
The span of values to compare.
referenceValues  ReadOnlySpan<T>
The span of reference values to compare against.
relativeTolerance  T
Optional. The relative tolerance.
equalNaN  Boolean  (Optional)
Optional. Specifies whether NaN values are considered equal. The default is false.
equalInfinity  Boolean  (Optional)
Optional. Specifies whether infinite values with the same sign are considered equal. The default is true.
symmetric  Boolean  (Optional)
Optional. If false (the default), the elements of referenceValues are used as the reference value. If true, the value with the largest magnitude is used as the reference value.

Type Parameters

T
The type of the values to compare.

Return Value

Boolean
true if all values are close; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ReadOnlySpan<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also