Class JaggedArray
Class that provides useful static methods for jagged arrays
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Collections
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
public static class JaggedArray
Methods
ConvertElements(Array, JaggedArray.ElementConverter)
Sets the elements of a jagged array
Declaration
public static void ConvertElements(Array jaggedArray, JaggedArray.ElementConverter converter)
Parameters
| Type | Name | Description |
|---|---|---|
| Array | jaggedArray | The source jagged array |
| JaggedArray.ElementConverter | converter | Element converter |
ConvertElements(Array, Type, JaggedArray.ElementConverter)
Sets the elements of a jagged array
Declaration
public static void ConvertElements(Array jaggedArray, Type leafType, JaggedArray.ElementConverter converter)
Parameters
| Type | Name | Description |
|---|---|---|
| Array | jaggedArray | The source jagged array |
| Type | leafType | The leaf type of the jagged array |
| JaggedArray.ElementConverter | converter | Element converter |
ConvertElements2(Array, Array, JaggedArray.ElementConverter2)
Sets the elements of a jagged array given another jagged
Declaration
public static void ConvertElements2(Array targetArray, Array sourceArray, JaggedArray.ElementConverter2 converter)
Parameters
| Type | Name | Description |
|---|---|---|
| Array | targetArray | The target array - also acts as a source |
| Array | sourceArray | The source array |
| JaggedArray.ElementConverter2 | converter | Element converter |
ConvertElements2(Array, Array, Type, JaggedArray.ElementConverter2)
Sets the elements of a jagged array given another jagged
Declaration
public static void ConvertElements2(Array targetArray, Array sourceArray, Type leafType, JaggedArray.ElementConverter2 converter)
Parameters
| Type | Name | Description |
|---|---|---|
| Array | targetArray | The target array - also acts as a source |
| Array | sourceArray | The source array |
| Type | leafType | The leaf type of the target array |
| JaggedArray.ElementConverter2 | converter | Element converter |
ConvertToNew(Array, Type, JaggedArray.ElementConverter)
Creates a jagged array with the same structure as another jagged array
Declaration
public static Array ConvertToNew(Array sourceArray, Type targetLeafType, JaggedArray.ElementConverter converter)
Parameters
| Type | Name | Description |
|---|---|---|
| Array | sourceArray | The source jagged array |
| Type | targetLeafType | The leaf type of the target jagged array |
| JaggedArray.ElementConverter | converter | Element converter |
Returns
| Type | Description |
|---|---|
| Array |
ConvertToNew(Array, Type, Type, JaggedArray.ElementConverter)
Creates a jagged array with the same structure as another jagged array
Declaration
public static Array ConvertToNew(Array sourceArray, Type sourceLeafType, Type targetLeafType, JaggedArray.ElementConverter converter)
Parameters
| Type | Name | Description |
|---|---|---|
| Array | sourceArray | The source jagged array |
| Type | sourceLeafType | The leaf type of the source jagged array |
| Type | targetLeafType | The leaf type of the target jagged array |
| JaggedArray.ElementConverter | converter | Element converter |
Returns
| Type | Description |
|---|---|
| Array |
ConvertToNew<SourceLeafType, TargetLeafType>(Array, JaggedArray.ElementConverter<SourceLeafType, TargetLeafType>)
Creates a jagged array with the same structure as another jagged array
Declaration
public static Array ConvertToNew<SourceLeafType, TargetLeafType>(Array sourceArray, JaggedArray.ElementConverter<SourceLeafType, TargetLeafType> converter)
Parameters
| Type | Name | Description |
|---|---|---|
| Array | sourceArray | The source array |
| JaggedArray.ElementConverter<SourceLeafType, TargetLeafType> | converter | The converter |
Returns
| Type | Description |
|---|---|
| Array |
Type Parameters
| Name | Description |
|---|---|
| SourceLeafType | Leaf type of the source jagged array |
| TargetLeafType | Leaf type of the target jagged array |
ElementIterator(IEnumerable)
Iterates over the elements of a jagged array
Declaration
public static IEnumerable ElementIterator(IEnumerable jaggedArray)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable | jaggedArray | The jagged array |
Returns
| Type | Description |
|---|---|
| IEnumerable |
ElementIterator(IEnumerable, Type)
Iterates over the elements of a jagged array when considered as an array over the specified leaf type
Declaration
public static IEnumerable ElementIterator(IEnumerable jaggedArray, Type leafType)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable | jaggedArray | The jagged array |
| Type | leafType | The leaf type |
Returns
| Type | Description |
|---|---|
| IEnumerable |
ElementIterator<LeafType>(IEnumerable)
Iterates over the elements of a jagged array when considered as an array over the specified leaf type
Declaration
public static IEnumerable ElementIterator<LeafType>(IEnumerable jaggedArray)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable | jaggedArray | The jagged array |
Returns
| Type | Description |
|---|---|
| IEnumerable |
Type Parameters
| Name | Description |
|---|---|
| LeafType | Leaf type |
GetDepth(Type)
Gets the depth of the jagged array
Declaration
public static int GetDepth(Type jaggedType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | jaggedType |
Returns
| Type | Description |
|---|---|
| Int32 |
GetDepth(Type, Type)
Gets the depth of the jagged array when considered an array over the specified leaf type
Declaration
public static int GetDepth(Type jaggedType, Type leafType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | jaggedType | |
| Type | leafType | The leaf type |
Returns
| Type | Description |
|---|---|
| Int32 |
GetDepth<JaggedType>()
Gets the depth of the jagged array
Declaration
public static int GetDepth<JaggedType>()
Returns
| Type | Description |
|---|---|
| Int32 |
Type Parameters
| Name | Description |
|---|---|
| JaggedType | Jagged array type |
GetDepth<JaggedType, LeafType>()
Gets the depth of the jagged array when considered an array over the specified leaf type
Declaration
public static int GetDepth<JaggedType, LeafType>()
Returns
| Type | Description |
|---|---|
| Int32 |
Type Parameters
| Name | Description |
|---|---|
| JaggedType | Jagge array type |
| LeafType | The leaf type |
GetInnermostType(Type)
Gets the innermost non-array type
Declaration
public static Type GetInnermostType(Type jaggedType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | jaggedType | Jagged array type |
Returns
| Type | Description |
|---|---|
| Type |
GetInnermostType<JaggedType>()
Gets the innermost non-array type
Declaration
public static Type GetInnermostType<JaggedType>()
Returns
| Type | Description |
|---|---|
| Type |
Type Parameters
| Name | Description |
|---|---|
| JaggedType | Jagged array type |
GetLength(IEnumerable)
Gets the total length of the jagged array
Declaration
public static int GetLength(IEnumerable jaggedArray)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable | jaggedArray | The jagged array |
Returns
| Type | Description |
|---|---|
| Int32 |
GetLength(IEnumerable, Type)
Gets the total length of the jagged array when considered as an array over the specified leaf type.
Declaration
public static int GetLength(IEnumerable jaggedArray, Type leafType)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable | jaggedArray | The jagged array |
| Type | leafType | The leaf type |
Returns
| Type | Description |
|---|---|
| Int32 |
GetLength<LeafType>(IEnumerable)
Gets the total length of the jagged array when considered as an array over the specified leaf type.
Declaration
public static int GetLength<LeafType>(IEnumerable jaggedArray)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable | jaggedArray | The jagged array |
Returns
| Type | Description |
|---|---|
| Int32 |
Type Parameters
| Name | Description |
|---|---|
| LeafType | The leaf type |
GetLongLength(IEnumerable)
Gets the total long length of the jagged array
Declaration
public static long GetLongLength(IEnumerable jaggedArray)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable | jaggedArray | The jagged array |
Returns
| Type | Description |
|---|---|
| Int64 |
GetLongLength(IEnumerable, Type)
Gets the total long length of the jagged array when considered as an array over the specified leaftype.
Declaration
public static long GetLongLength(IEnumerable jaggedArray, Type leafType)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable | jaggedArray | The jagged array |
| Type | leafType | The leaf type |
Returns
| Type | Description |
|---|---|
| Int64 |
GetLongLength<LeafType>(IEnumerable)
Gets the total long length of the jagged array when considered as an array over the specified leaf type.
Declaration
public static long GetLongLength<LeafType>(IEnumerable jaggedArray)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable | jaggedArray | The jagged array |
Returns
| Type | Description |
|---|---|
| Int64 |
Type Parameters
| Name | Description |
|---|---|
| LeafType | The leaf type |
GetRanks(Type)
Gets the ranks of a jagged array down to the first non-array type
Declaration
public static int[] GetRanks(Type jaggedType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | jaggedType | The jagged array type |
Returns
| Type | Description |
|---|---|
| Int32[] |
GetRanks(Type, Type)
Gets the ranks of a jagged array type when considered an array
Declaration
public static int[] GetRanks(Type jaggedType, Type leafType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | jaggedType | The jagged array type |
| Type | leafType | The leaf type |
Returns
| Type | Description |
|---|---|
| Int32[] |
GetRanks<JaggedType>()
Gets the ranks of a jagged array down to the first non-array type
Declaration
public static int[] GetRanks<JaggedType>()
Returns
| Type | Description |
|---|---|
| Int32[] |
Type Parameters
| Name | Description |
|---|---|
| JaggedType | Jagged array type |
GetRanks<JaggedType, LeafType>()
Gets the ranks of a jagged array type when considered an array over the specified leaf type
Declaration
public static int[] GetRanks<JaggedType, LeafType>()
Returns
| Type | Description |
|---|---|
| Int32[] |
Type Parameters
| Name | Description |
|---|---|
| JaggedType | The jagged array type |
| LeafType | The leaf type |
GetTypes(Type)
Gets the types at each depth of a jagged array
Declaration
public static Type[] GetTypes(Type jaggedType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | jaggedType | Jagged array type |
Returns
| Type | Description |
|---|---|
| Type[] |
GetTypes(Type, Type)
Gets the types at each depth of a jagged array when considered as a jagged array over the specified leaf type
Declaration
public static Type[] GetTypes(Type jaggedType, Type leafType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | jaggedType | Jagged array type |
| Type | leafType | Leaf type |
Returns
| Type | Description |
|---|---|
| Type[] |
GetTypes(Type, Type, Type)
Gets jagged array types for the target leaf type to match the given jagged array considered as an array over the specified leaf type
Declaration
public static Type[] GetTypes(Type jaggedType, Type leafType, Type targetLeafType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | jaggedType | Jagged array type |
| Type | leafType | Leaf type |
| Type | targetLeafType | Desired leaf type |
Returns
| Type | Description |
|---|---|
| Type[] |
GetTypes<JaggedType>()
Gets the types at each depth of a jagged array
Declaration
public static Type[] GetTypes<JaggedType>()
Returns
| Type | Description |
|---|---|
| Type[] |
Type Parameters
| Name | Description |
|---|---|
| JaggedType | Jagged array type |
GetTypes<JaggedType, LeafType>()
Gets the types at each depth of a jagged array when considered as a jagged array over the specified leaf type
Declaration
public static Type[] GetTypes<JaggedType, LeafType>()
Returns
| Type | Description |
|---|---|
| Type[] |
Type Parameters
| Name | Description |
|---|---|
| JaggedType | Jagged array type |
| LeafType | Leaf type |
GetTypes<JaggedType, LeafType, TargetLeafType>()
Gets jagged array types for the target leaf type to match the given jagged array considered as an array over the specified leaf type
Declaration
public static Type[] GetTypes<JaggedType, LeafType, TargetLeafType>()
Returns
| Type | Description |
|---|---|
| Type[] |
Type Parameters
| Name | Description |
|---|---|
| JaggedType | Jagged array type |
| LeafType | Leaf type |
| TargetLeafType | Target leaf type |
VisitElements(IEnumerable, JaggedArray.ElementAction)
Visits all elements and perform the action
Declaration
public static void VisitElements(IEnumerable jaggedArray, JaggedArray.ElementAction action)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable | jaggedArray | Jagged array |
| JaggedArray.ElementAction | action | Action delegate |
VisitElements(IEnumerable, Type, JaggedArray.ElementAction)
Visits all elements with the specified leaf type, and perform the action
Declaration
public static void VisitElements(IEnumerable jaggedArray, Type leafType, JaggedArray.ElementAction action)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable | jaggedArray | Jagged array |
| Type | leafType | Element type |
| JaggedArray.ElementAction | action | Action delegate |
VisitElements2(IEnumerable, IEnumerable, JaggedArray.ElementAction2)
Visits all elements oftwo jagged arrays, and perform the action
Declaration
public static void VisitElements2(IEnumerable jaggedArray1, IEnumerable jaggedArray2, JaggedArray.ElementAction2 action)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable | jaggedArray1 | First jagged array |
| IEnumerable | jaggedArray2 | Second jagged array |
| JaggedArray.ElementAction2 | action | The action to take |
Remarks
There is no checking of compatibility between the two jagged arrays
VisitElements2(IEnumerable, IEnumerable, Type, Type, JaggedArray.ElementAction2)
Visits all elements oftwo jagged arrays, and perform the action
Declaration
public static void VisitElements2(IEnumerable jaggedArray1, IEnumerable jaggedArray2, Type leafType1, Type leafType2, JaggedArray.ElementAction2 action)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable | jaggedArray1 | First jagged array |
| IEnumerable | jaggedArray2 | Second jagged array |
| Type | leafType1 | Leaf type of first jagged array element |
| Type | leafType2 | Leaf type of second jagged array element |
| JaggedArray.ElementAction2 | action | The action to take |
Remarks
There is no checking of compatibility between the two jagged arrays