Class NDArray<TDType>
public class NDArray<TDType> : NDArray, IIndex, ICloneable, IEnumerable where TDType : unmanaged
Type Parameters
TDType
- Inheritance
-
NDArray<TDType>
- Implements
- Inherited Members
- Extension Methods
Constructors
NDArray()
Constructor for init data type internal storage is 1D with 1 element
public NDArray()
Remarks
This constructor does not call allocation/>
NDArray(IArraySlice, Shape, char)
Constructor which takes .NET array dtype and shape is determined from array
public NDArray(IArraySlice values, Shape shape = default, char order = 'C')
Parameters
valuesIArraySliceshapeShapeorderchar
Remarks
This constructor calls IStorage.Allocate(NumSharp.Shape,System.Type)
NDArray(UnmanagedStorage)
Creates a new NDArray with this storage.
protected NDArray(UnmanagedStorage storage)
Parameters
storageUnmanagedStorage
NDArray(UnmanagedStorage, Shape)
Creates a new NDArray with this storage.
protected NDArray(UnmanagedStorage storage, Shape shape)
Parameters
storageUnmanagedStorageshapeShape
NDArray(UnmanagedStorage, ref Shape)
Creates a new NDArray with this storage.
protected NDArray(UnmanagedStorage storage, ref Shape shape)
Parameters
storageUnmanagedStorageshapeShape
NDArray(Shape)
Constructor which initialize elements with 0 type and shape are given.
public NDArray(Shape shape)
Parameters
shapeShapeShape of NDArray
Remarks
This constructor calls IStorage.Allocate(NumSharp.Shape,System.Type)
NDArray(Shape, bool)
Constructor which initialize elements with 0 type and shape are given.
public NDArray(Shape shape, bool fillZeros)
Parameters
shapeShapeShape of NDArray
fillZerosboolShould set the values of the new allocation to default(dtype)? otherwise - old memory noise
Remarks
This constructor calls IStorage.Allocate(NumSharp.Shape,System.Type)
NDArray(TensorEngine)
Constructor for init data type internal storage is 1D with 1 element
protected NDArray(TensorEngine engine)
Parameters
engineTensorEngineThe engine of this NDArray
Remarks
This constructor does not call allocation/>
NDArray(Array, Shape, char)
Constructor which takes .NET array dtype and shape is determined from array
public NDArray(Array values, Shape shape = default, char order = 'C')
Parameters
Remarks
This constructor calls IStorage.Allocate(NumSharp.Shape,System.Type)
NDArray(int)
Constructor which initialize elements with length of size
public NDArray(int size)
Parameters
sizeintThe size as a single dimension shape
Remarks
This constructor calls IStorage.Allocate(NumSharp.Shape,System.Type)
NDArray(int, bool)
Constructor which initialize elements with length of size
public NDArray(int size, bool fillZeros)
Parameters
sizeintThe size as a single dimension shape
fillZerosboolShould set the values of the new allocation to default(dtype)? otherwise - old memory noise
Remarks
This constructor calls IStorage.Allocate(NumSharp.Shape,System.Type)
Properties
Address
Gets the address that this NDArray starts from.
protected TDType* Address { get; }
Property Value
- TDType*
Array
Array access to storage data - overridden on purpose
protected ArraySlice<TDType> Array { get; set; }
Property Value
- ArraySlice<TDType>
this[Slice[]]
slicing of generic - overridden on purpose
public NDArray<TDType> this[params Slice[] slices] { get; set; }
Parameters
slicesSlice[]
Property Value
- NDArray<TDType>
this[int[]]
public TDType this[params int[] indices] { get; set; }
Parameters
indicesint[]
Property Value
- TDType
this[string]
slicing of generic - overridden on purpose
public NDArray<TDType> this[string slice] { get; set; }
Parameters
slicestring
Property Value
- NDArray<TDType>
T
The transposed array.
Same as self.transpose().
public NDArray<TDType> T { get; }
Property Value
- NDArray<TDType>
Remarks
flat
A 1-D iterator over the array.
public NDArray<TDType> flat { get; }
Property Value
- NDArray<TDType>
Remarks
Methods
GetAtIndex(int)
public TDType GetAtIndex(int index)
Parameters
indexint
Returns
- TDType
reshape(Shape)
Gives a new shape to an array without changing its data.
public NDArray<TDType> reshape(Shape newShape)
Parameters
newShapeShapeThe new shape should be compatible with the original shape. If an integer, then the result will be a 1-D array of that length. One shape dimension can be -1. In this case, the value is inferred from the length of the array and remaining dimensions.
Returns
- NDArray<TDType>
This will be a new view object if possible; otherwise, it will be a copy. Note there is no guarantee of the memory layout (C- or Fortran- contiguous) of the returned array.
Remarks
reshape(ref Shape)
Gives a new shape to an array without changing its data.
public NDArray<TDType> reshape(ref Shape newShape)
Parameters
newShapeShapeThe new shape should be compatible with the original shape. If an integer, then the result will be a 1-D array of that length. One shape dimension can be -1. In this case, the value is inferred from the length of the array and remaining dimensions.
Returns
- NDArray<TDType>
This will be a new view object if possible; otherwise, it will be a copy. Note there is no guarantee of the memory layout (C- or Fortran- contiguous) of the returned array.
Remarks
reshape(params int[])
Gives a new shape to an array without changing its data.
[SuppressMessage("ReSharper", "ParameterHidesMember")]
public NDArray<TDType> reshape(params int[] shape)
Parameters
shapeint[]The new shape should be compatible with the original shape. If an integer, then the result will be a 1-D array of that length. One shape dimension can be -1. In this case, the value is inferred from the length of the array and remaining dimensions.
Returns
- NDArray<TDType>
This will be a new view object if possible; otherwise, it will be a copy. Note there is no guarantee of the memory layout (C- or Fortran- contiguous) of the returned array.
Remarks
reshape_unsafe(Shape)
Gives a new shape to an array without changing its data.
public NDArray<TDType> reshape_unsafe(Shape newshape)
Parameters
newshapeShapeThe new shape should be compatible with the original shape. If an integer, then the result will be a 1-D array of that length. One shape dimension can be -1. In this case, the value is inferred from the length of the array and remaining dimensions.
Returns
- NDArray<TDType>
This will be a new view object if possible; otherwise, it will be a copy. Note there is no guarantee of the memory layout (C- or Fortran- contiguous) of the returned array.
Remarks
reshape_unsafe(ref Shape)
Gives a new shape to an array without changing its data.
public NDArray<TDType> reshape_unsafe(ref Shape newShape)
Parameters
newShapeShape
Returns
- NDArray<TDType>
This will be a new view object if possible; otherwise, it will be a copy. Note there is no guarantee of the memory layout (C- or Fortran- contiguous) of the returned array.
Remarks
reshape_unsafe(params int[])
Gives a new shape to an array without changing its data.
[SuppressMessage("ReSharper", "ParameterHidesMember")]
public NDArray<TDType> reshape_unsafe(params int[] shape)
Parameters
shapeint[]The new shape should be compatible with the original shape. If an integer, then the result will be a 1-D array of that length. One shape dimension can be -1. In this case, the value is inferred from the length of the array and remaining dimensions.
Returns
- NDArray<TDType>
This will be a new view object if possible; otherwise, it will be a copy. Note there is no guarantee of the memory layout (C- or Fortran- contiguous) of the returned array.
Remarks
Operators
explicit operator NDArray<TDType>(TDType[])
public static explicit operator NDArray<TDType>(TDType[] tArray)
Parameters
tArrayTDType[]
Returns
- NDArray<TDType>
implicit operator ArraySlice<TDType>(NDArray<TDType>)
public static implicit operator ArraySlice<TDType>(NDArray<TDType> nd)
Parameters
ndNDArray<TDType>
Returns
- ArraySlice<TDType>