File: _typedefs.pyx

package info (click to toggle)
scikit-learn 0.23.2-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 21,892 kB
  • sloc: python: 132,020; cpp: 5,765; javascript: 2,201; ansic: 831; makefile: 213; sh: 44
file content (26 lines) | stat: -rw-r--r-- 769 bytes parent folder | download
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
#!python

import numpy as np
cimport numpy as np
from libc.math cimport sqrt

np.import_array()


# use a hack to determine the associated numpy data types
# NOTE: the following requires the buffer interface, only available in
#       numpy 1.5+.  We'll choose the DTYPE by hand instead.
#cdef ITYPE_t idummy
#cdef ITYPE_t[:] idummy_view = <ITYPE_t[:1]> &idummy
#ITYPE = np.asarray(idummy_view).dtype
ITYPE = np.intp  # WARNING: this should match ITYPE_t in typedefs.pxd

#cdef DTYPE_t ddummy
#cdef DTYPE_t[:] ddummy_view = <DTYPE_t[:1]> &ddummy
#DTYPE = np.asarray(ddummy_view).dtype
DTYPE = np.float64  # WARNING: this should match DTYPE_t in typedefs.pxd

# some handy constants
cdef DTYPE_t INF = np.inf
cdef DTYPE_t PI = np.pi
cdef DTYPE_t ROOT_2PI = sqrt(2 * PI)