File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,27 @@ public partial class NDArray
1111 public override string ToString ( )
1212 {
1313 string output = "" ;
14-
15- if ( this . ndim == 2 )
14+ if ( this . ndim == 0 )
15+ {
16+ switch ( dtype . Name )
17+ {
18+ case "Int16" :
19+ output = Data < short > ( ) [ 0 ] . ToString ( ) ;
20+ break ;
21+ case "Int32" :
22+ output = Data < int > ( ) [ 0 ] . ToString ( ) ;
23+ break ;
24+ case "Double" :
25+ output = Data < double > ( ) [ 0 ] . ToString ( ) ;
26+ break ;
27+ case "String" :
28+ output = Data < string > ( ) [ 0 ] . ToString ( ) ;
29+ break ;
30+ default :
31+ throw new NotImplementedException ( "NDArray ToString()" ) ;
32+ }
33+ }
34+ else if ( this . ndim == 2 )
1635 {
1736 if ( dtype == typeof ( int ) )
1837 {
Original file line number Diff line number Diff line change @@ -178,7 +178,14 @@ public int DTypeSize
178178 {
179179 get
180180 {
181- return Marshal . SizeOf ( _DType ) ;
181+ if ( _DType == typeof ( string ) )
182+ {
183+ return 0 ;
184+ }
185+ else
186+ {
187+ return Marshal . SizeOf ( _DType ) ;
188+ }
182189 }
183190 }
184191 /// <summary>
You can’t perform that action at this time.
0 commit comments