Click or drag to resize
Accord.NET (logo)

VectorGetIndicesT Method

Creates a vector containing every index that can be used to address a given array, in order.

Namespace:  Accord.Math
Assembly:  Accord.Math (in Accord.Math.dll) Version: 3.8.0
Syntax
public static int[] GetIndices<T>(
	this T[] array
)
Request Example View Source

Parameters

array
Type: T
The array whose indices will be returned.

Type Parameters

T

Return Value

Type: Int32
A vector of the same size as the given array containing all vector indices from 0 up to the length of array.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type . 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).
Examples
double[] a = { 5.3, 2.3, 4.2 };
int[] idx = a.GetIndices(); // output will be { 0, 1, 2 }
See Also