Class NDStorage
Inheritance
Inherited Members
Namespace: NumSharp.Core
Assembly: NumSharp.Core.dll
Syntax
public class NDStorage : IStorage, ICloneable
Constructors
| Improve this Doc View SourceNDStorage()
Declaration
public NDStorage()
NDStorage(Double[])
Declaration
public NDStorage(double[] values)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | values |
NDStorage(Object[])
Declaration
public NDStorage(object[] values)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | values |
NDStorage(Type)
Declaration
public NDStorage(Type dtype)
Parameters
Type | Name | Description |
---|---|---|
System.Type | dtype |
Fields
| Improve this Doc View Source_DType
Declaration
protected Type _DType
Field Value
Type | Description |
---|---|
System.Type |
_Shape
Declaration
protected IShape _Shape
Field Value
Type | Description |
---|---|
IShape |
_TensorLayout
Declaration
protected int _TensorLayout
Field Value
Type | Description |
---|---|
System.Int32 |
_values
Declaration
protected Array _values
Field Value
Type | Description |
---|---|
System.Array |
Properties
| Improve this Doc View SourceDType
Data Type of stored elements
Declaration
public Type DType { get; }
Property Value
Type | Description |
---|---|
System.Type | numpys equal dtype |
Shape
storage shape for outside representation
Declaration
public IShape Shape { get; }
Property Value
Type | Description |
---|---|
IShape | numpys equal shape |
TensorLayout
column wise or row wise order
Declaration
public int TensorLayout { get; }
Property Value
Type | Description |
---|---|
System.Int32 | 0 row wise, 1 column wise |
Methods
| Improve this Doc View Source_ChangeColumnToRowLayout()
Declaration
protected void _ChangeColumnToRowLayout()
_ChangeRowToColumnLayout()
Declaration
protected void _ChangeRowToColumnLayout()
_ChangeTypeOfArray(Array, Type)
Declaration
protected Array _ChangeTypeOfArray(Array arrayVar, Type dtype)
Parameters
Type | Name | Description |
---|---|---|
System.Array | arrayVar | |
System.Type | dtype |
Returns
Type | Description |
---|---|
System.Array |
Allocate(Array, Int32)
Allocate memory by Array and tensororder and deduce shape and dtype (default column wise)
Declaration
public void Allocate(Array values, int tensorOrder = 1)
Parameters
Type | Name | Description |
---|---|---|
System.Array | values | elements to store |
System.Int32 | tensorOrder | row or column wise |
Allocate(Type, IShape, Int32)
Allocate memory by dtype, shape, tensororder (default column wise)
Declaration
public void Allocate(Type dtype, IShape shape, int tensorOrder = 1)
Parameters
Type | Name | Description |
---|---|---|
System.Type | dtype | storage data type |
IShape | shape | storage data shape |
System.Int32 | tensorOrder | row or column wise |
ChangeDataType(Type)
Change dtype of elements
Declaration
public void ChangeDataType(Type dtype)
Parameters
Type | Name | Description |
---|---|---|
System.Type | dtype | new storage data type |
ChangeTensorLayout(Int32)
Cange layout to 0 row wise or 1 colum wise
Declaration
public void ChangeTensorLayout(int layout)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | layout |
Clone()
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object |
CloneData()
Clone internal storage and get reference to it
Declaration
public Array CloneData()
Returns
Type | Description |
---|---|
System.Array | reference to cloned storage as System.Array |
CloneData(Type)
Clone internal storage and cast elements to new dtype
Declaration
public Array CloneData(Type dtype)
Parameters
Type | Name | Description |
---|---|---|
System.Type | dtype | cloned storage data type |
Returns
Type | Description |
---|---|
System.Array | reference to cloned storage as System.Array |
CloneData<T>()
Get all elements from cloned storage as T[] and cast dtype
Declaration
public T[] CloneData<T>()
Returns
Type | Description |
---|---|
T[] | reference to cloned storage as T[] |
Type Parameters
Name | Description |
---|---|
T | cloned storgae dtype |
GetColumWiseStorage()
Get Back Storage with Columnwise tensor Layout By this method the layout is changed if layout is not columnwise
Declaration
public IStorage GetColumWiseStorage()
Returns
Type | Description |
---|---|
IStorage | reference to storage (transformed or not) |
GetData()
Get reference to internal data storage
Declaration
public Array GetData()
Returns
Type | Description |
---|---|
System.Array | reference to internal storage as System.Array |
GetData(Int32[])
Get single value from internal storage and do not cast dtype
Declaration
public object GetData(params int[] indexes)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | indexes | indexes |
Returns
Type | Description |
---|---|
System.Object | element from internal storage |
GetData(Type)
Get reference to internal data storage and cast elements to new dtype
Declaration
public Array GetData(Type dtype)
Parameters
Type | Name | Description |
---|---|---|
System.Type | dtype | new storage data type |
Returns
Type | Description |
---|---|
System.Array | reference to internal (casted) storage as System.Array |
GetData<T>()
Get reference to internal data storage and cast elements to new dtype
Declaration
public T[] GetData<T>()
Returns
Type | Description |
---|---|
T[] | reference to internal (casted) storage as T[] |
Type Parameters
Name | Description |
---|---|
T | new storage data type |
GetData<T>(Int32[])
Get single value from internal storage as type T and cast dtype to T
Declaration
public T GetData<T>(params int[] indexes)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | indexes | indexes |
Returns
Type | Description |
---|---|
T | element from internal storage |
Type Parameters
Name | Description |
---|---|
T | new storage data type |
GetRowWiseStorage()
Get Back Storage with row wise tensor Layout By this method the layout is changed if layout is not row wise
Declaration
public IStorage GetRowWiseStorage()
Returns
Type | Description |
---|---|
IStorage | reference to storage (transformed or not) |
Reshape(Int32[])
Declaration
public void Reshape(params int[] dimensions)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | dimensions |
SetData(Array)
Set an array to internal storage and keep dtype
Declaration
public void SetData(Array values)
Parameters
Type | Name | Description |
---|---|---|
System.Array | values |
SetData(Array, Type)
Set an Array to internal storage, cast it to new dtype and change dtype
Declaration
public void SetData(Array values, Type dtype)
Parameters
Type | Name | Description |
---|---|---|
System.Array | values | |
System.Type | dtype |
SetData(Object, Int32[])
Set 1 single value to internal storage and keep dtype
Declaration
public void SetData(object value, params int[] indexes)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | |
System.Int32[] | indexes |
SetData<T>(Array)
Set a 1D Array of type T to internal storage and cast dtype
Declaration
public void SetData<T>(Array values)
Parameters
Type | Name | Description |
---|---|---|
System.Array | values |
Type Parameters
Name | Description |
---|---|
T |