ElementComparerT Class |
Namespace: Accord.Math.Comparers
The ElementComparerT type exposes the following members.
Name | Description | |
---|---|---|
ElementComparerT | Initializes a new instance of the ElementComparerT class |
Name | Description | |
---|---|---|
Compare |
Compares two objects and returns a value indicating
whether one is less than, equal to, or greater than the other.
| |
Equals(Object) | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Equals(T, T) |
Determines whether two instances are equal.
| |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetHashCode(T) |
Returns a hash code for a given instance.
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(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.) | |
ToT | 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.) |
// We sort the arrays according to the // elements at their second column. double[][] values = { // v new double[] { 0, 3, 0 }, new double[] { 0, 4, 1 }, new double[] { -1, 1, 1 }, new double[] { -1, 5, 4 }, new double[] { -2, 2, 6 }, }; // Sort the array considering only the second column Array.Sort(values, new ElementComparer() { Index = 1 }); // The result will be double[][] result = { new double[] { -1, 1, 1 }, new double[] { -2, 2, 6 }, new double[] { 0, 3, 0 }, new double[] { 0, 4, 1 }, new double[] { -1, 5, 4 }, };