forked from SciSharp/NumSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnp.asarray.cs
More file actions
33 lines (30 loc) · 937 Bytes
/
np.asarray.cs
File metadata and controls
33 lines (30 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
namespace NumSharp
{
public static partial class np
{
public static NDArray asarray(string data)
{
var nd = new NDArray(typeof(string), new int[0]);
nd.ReplaceData(new string[] {data});
return nd;
}
public static NDArray asarray<T>(T data) where T : struct
{
var nd = new NDArray(typeof(T), new int[0]);
nd.ReplaceData(new T[] {data});
return nd;
}
public static NDArray asarray(string[] data, int ndim = 1)
{
var nd = new NDArray(typeof(string), new Shape(data.Length));
nd.ReplaceData(data);
return nd;
}
public static NDArray asarray<T>(T[] data, int ndim = 1) where T : struct
{
var nd = new NDArray(typeof(T), new Shape(data.Length));
nd.ReplaceData(data);
return nd;
}
}
}