File: example.py

package info (click to toggle)
python-numpy 1%3A1.16.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 25,116 kB
  • sloc: ansic: 158,812; python: 115,039; cpp: 1,112; makefile: 502; sh: 314; f90: 289; sed: 140; fortran: 121; perl: 68
file content (18 lines) | stat: -rw-r--r-- 584 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from __future__ import division, absolute_import, print_function

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...