-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish simple example for new data-type and add test.
- Loading branch information
1 parent
91ee5fe
commit 0dba087
Showing
2 changed files
with
31 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import floatint.floatint as ff | ||
import numpy as np | ||
|
||
# Setting using array is hard because | ||
# The parser doesn't stop at tuples always | ||
# So, the setitem code will be called with scalars on the | ||
# wrong shaped array. | ||
# But we can get a view as an ndarray of the given type: | ||
g = np.array([1,2,3,4,5,6,7,8]).view(ff.floatint_type) | ||
|
||
# Now, the elements will be the scalar type associated | ||
# with the ndarray. | ||
print g[0] | ||
print type(g[1]) | ||
|
||
# Now, you need to register ufuncs and more arrfuncs to do useful things... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters