Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
28baecd5
Commit
28baecd5
authored
Nov 10, 2008
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include complex float structs in numpy.pxd
parent
21d383ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
16 deletions
+19
-16
Cython/Includes/numpy.pxd
Cython/Includes/numpy.pxd
+16
-1
tests/run/numpy_test.pyx
tests/run/numpy_test.pyx
+3
-15
No files found.
Cython/Includes/numpy.pxd
View file @
28baecd5
...
...
@@ -241,6 +241,18 @@ cdef extern from "numpy/arrayobject.h":
ctypedef
float
npy_float96
ctypedef
float
npy_float128
ctypedef
struct
npy_cfloat
:
float
real
float
imag
ctypedef
struct
npy_cdouble
:
double
real
double
imag
ctypedef
struct
npy_clongdouble
:
long
double
real
long
double
imag
# Typedefs that matches the runtime dtype objects in
# the numpy module.
...
...
@@ -274,7 +286,10 @@ ctypedef npy_longlong long_t
ctypedef
npy_ulong
uint_t
ctypedef
npy_ulonglong
ulong_t
ctypedef
npy_double
float_t
ctypedef
npy_double
float_t
ctypedef
npy_double
double_t
ctypedef
npy_longdouble
longdouble_t
ctypedef
npy_cfloat
cfloat_t
ctypedef
npy_cdouble
cdouble_t
ctypedef
npy_clongdouble
clongdouble_t
tests/run/numpy_test.pyx
View file @
28baecd5
...
...
@@ -202,18 +202,6 @@ def test_f_contig(np.ndarray[int, ndim=2, mode='fortran'] arr):
for
i
in
range
(
arr
.
shape
[
0
]):
print
" "
.
join
([
str
(
arr
[
i
,
j
])
for
j
in
range
(
arr
.
shape
[
1
])])
cdef
struct
cfloat
:
float
real
float
imag
cdef
struct
cdouble
:
double
real
double
imag
cdef
struct
clongdouble
:
long
double
real
long
double
imag
# Exhaustive dtype tests -- increments element [1] by 1 (or 1+1j) for all dtypes
def
inc1_byte
(
np
.
ndarray
[
char
]
arr
):
arr
[
1
]
+=
1
def
inc1_ubyte
(
np
.
ndarray
[
unsigned
char
]
arr
):
arr
[
1
]
+=
1
...
...
@@ -230,15 +218,15 @@ def inc1_float(np.ndarray[float] arr): arr[1] += 1
def
inc1_double
(
np
.
ndarray
[
double
]
arr
):
arr
[
1
]
+=
1
def
inc1_longdouble
(
np
.
ndarray
[
long
double
]
arr
):
arr
[
1
]
+=
1
def
inc1_cfloat
(
np
.
ndarray
[
cfloa
t
]
arr
):
def
inc1_cfloat
(
np
.
ndarray
[
np
.
cfloat_
t
]
arr
):
arr
[
1
].
real
+=
1
arr
[
1
].
imag
+=
1
def
inc1_cdouble
(
np
.
ndarray
[
cdouble
]
arr
):
def
inc1_cdouble
(
np
.
ndarray
[
np
.
cdouble_t
]
arr
):
arr
[
1
].
real
+=
1
arr
[
1
].
imag
+=
1
def
inc1_clongdouble
(
np
.
ndarray
[
clongdouble
]
arr
):
def
inc1_clongdouble
(
np
.
ndarray
[
np
.
clongdouble_t
]
arr
):
cdef
long
double
x
x
=
arr
[
1
].
real
+
1
arr
[
1
].
real
=
x
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment