Interface IStorage
Inherited Members
Namespace: NumSharp.Core.Interfaces
Assembly: NumSharp.Core.dll
Syntax
public interface IStorage : ICloneable
Properties
| Improve this Doc View SourceDType
Data Type of stored elements
Declaration
Type DType { get; }
Property Value
Type | Description |
---|---|
System.Type | numpys equal dtype |
Shape
storage shape for outside representation
Declaration
IShape Shape { get; }
Property Value
Type | Description |
---|---|
IShape | numpys equal shape |
TensorLayout
column wise or row wise order
Declaration
int TensorLayout { get; }
Property Value
Type | Description |
---|---|
System.Int32 | 0 row wise, 1 column wise |
Methods
| Improve this Doc View SourceAllocate(Array, Int32)
Allocate memory by Array and tensororder and deduce shape and dtype (default column wise)
Declaration
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
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
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
void ChangeTensorLayout(int order)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | order | 0 or 1 |
CloneData()
Clone internal storage and get reference to it
Declaration
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
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
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
IStorage GetColumWiseStorage()
Returns
Type | Description |
---|---|
IStorage | reference to storage (transformed or not) |
GetData()
Get reference to internal data storage
Declaration
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
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
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
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
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
IStorage GetRowWiseStorage()
Returns
Type | Description |
---|---|
IStorage | reference to storage (transformed or not) |
Reshape(Int32[])
Declaration
void Reshape(params int[] dimensions)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | dimensions |
SetData(Array)
Set an array to internal storage and keep dtype
Declaration
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
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
void SetData(object value, params int[] indexes)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | |
System.Int32[] | indexes |