10
10
from .interoperability import *
11
11
from .ndarray import Array
12
12
13
-
14
13
__all__ = [
15
14
'full' , 'full_like' , 'eye' , 'identity' , 'diag' , 'tri' , 'tril' , 'triu' ,
16
15
'empty' , 'empty_like' , 'ones' , 'ones_like' , 'zeros' , 'zeros_like' ,
92
91
'ravel_multi_index' , 'result_type' , 'sort_complex' , 'unpackbits' , 'delete' ,
93
92
94
93
# unique
95
- 'add_docstring' , 'add_newdoc' , 'add_newdoc_ufunc' , 'array2string' , 'asanyarray' ,
96
- 'ascontiguousarray' , 'asfarray' , 'asscalar' , 'common_type' , 'disp' , 'genfromtxt' ,
97
- 'loadtxt' , 'info' , 'issubclass_' , 'place' , 'polydiv' , 'put' , 'putmask' , 'safe_eval' ,
94
+ 'asanyarray' , 'ascontiguousarray' , 'asfarray' , 'asscalar' , 'common_type' , 'genfromtxt' ,
95
+ 'loadtxt' , 'info' , 'place' , 'polydiv' , 'put' , 'putmask' , 'safe_eval' ,
98
96
'savetxt' , 'savez_compressed' , 'show_config' , 'typename' , 'copyto' , 'matrix' , 'asmatrix' , 'mat' ,
99
97
100
98
]
@@ -204,11 +202,12 @@ def ascontiguousarray(a, dtype=None, order=None):
204
202
return asarray (a , dtype = dtype , order = order )
205
203
206
204
207
- def asfarray (a , dtype = np . float_ ):
205
+ def asfarray (a , dtype = None ):
208
206
if not np .issubdtype (dtype , np .inexact ):
209
- dtype = np .float_
207
+ dtype = np .float64
210
208
return asarray (a , dtype = dtype )
211
209
210
+
212
211
def in1d (ar1 , ar2 , assume_unique : bool = False , invert : bool = False ) -> Array :
213
212
del assume_unique
214
213
ar1_flat = ravel (ar1 )
@@ -227,6 +226,7 @@ def in1d(ar1, ar2, assume_unique: bool = False, invert: bool = False) -> Array:
227
226
else :
228
227
return asarray ((ar1_flat [:, None ] == ar2_flat [None , :]).any (- 1 ))
229
228
229
+
230
230
# Others
231
231
# ------
232
232
meshgrid = _compatible_with_brainpy_array (jnp .meshgrid )
@@ -454,7 +454,6 @@ def msort(a):
454
454
sometrue = any
455
455
456
456
457
-
458
457
def shape (a ):
459
458
"""
460
459
Return the shape of an array.
@@ -648,7 +647,6 @@ def size(a, axis=None):
648
647
finfo = jnp .finfo
649
648
iinfo = jnp .iinfo
650
649
651
-
652
650
can_cast = _compatible_with_brainpy_array (jnp .can_cast )
653
651
choose = _compatible_with_brainpy_array (jnp .choose )
654
652
copy = _compatible_with_brainpy_array (jnp .copy )
@@ -678,23 +676,6 @@ def size(a, axis=None):
678
676
# Unique APIs
679
677
# -----------
680
678
681
- add_docstring = np .add_docstring
682
- add_newdoc = np .add_newdoc
683
- add_newdoc_ufunc = np .add_newdoc_ufunc
684
-
685
-
686
- def array2string (a , max_line_width = None , precision = None ,
687
- suppress_small = None , separator = ' ' , prefix = "" ,
688
- style = np ._NoValue , formatter = None , threshold = None ,
689
- edgeitems = None , sign = None , floatmode = None , suffix = "" ,
690
- legacy = None ):
691
- a = as_numpy (a )
692
- return array2string (a , max_line_width = max_line_width , precision = precision ,
693
- suppress_small = suppress_small , separator = separator , prefix = prefix ,
694
- style = style , formatter = formatter , threshold = threshold ,
695
- edgeitems = edgeitems , sign = sign , floatmode = floatmode , suffix = suffix ,
696
- legacy = legacy )
697
-
698
679
699
680
def asscalar (a ):
700
681
return a .item ()
@@ -731,13 +712,9 @@ def common_type(*arrays):
731
712
return array_type [0 ][precision ]
732
713
733
714
734
- disp = np .disp
735
-
736
715
genfromtxt = lambda * args , ** kwargs : asarray (np .genfromtxt (* args , ** kwargs ))
737
716
loadtxt = lambda * args , ** kwargs : asarray (np .loadtxt (* args , ** kwargs ))
738
-
739
717
info = np .info
740
- issubclass_ = np .issubclass_
741
718
742
719
743
720
def place (arr , mask , vals ):
0 commit comments