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
6f060c90
Commit
6f060c90
authored
Oct 15, 2009
by
Dag Sverre Seljebotn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
complexvar.conjugate() support
parent
6add62f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+16
-3
tests/run/complex_numbers_T305.pyx
tests/run/complex_numbers_T305.pyx
+10
-6
No files found.
Cython/Compiler/PyrexTypes.py
View file @
6f060c90
...
@@ -871,9 +871,22 @@ class CComplexType(CNumericType):
...
@@ -871,9 +871,22 @@ class CComplexType(CNumericType):
def
attributes_known
(
self
):
def
attributes_known
(
self
):
if
self
.
scope
is
None
:
if
self
.
scope
is
None
:
import
Symtab
import
Symtab
self
.
scope
=
Symtab
.
StructOrUnionScope
(
self
.
specalization_name
())
self
.
scope
=
scope
=
Symtab
.
CClassScope
(
self
.
scope
.
declare_var
(
"real"
,
self
.
real_type
,
None
,
"real"
)
''
,
self
.
scope
.
declare_var
(
"imag"
,
self
.
real_type
,
None
,
"imag"
)
None
,
visibility
=
"extern"
)
scope
.
parent_type
=
self
scope
.
declare_var
(
"real"
,
self
.
real_type
,
None
,
"real"
,
is_cdef
=
True
)
scope
.
declare_var
(
"imag"
,
self
.
real_type
,
None
,
"imag"
,
is_cdef
=
True
)
entry
=
scope
.
declare_cfunction
(
"conjugate"
,
CFuncType
(
self
,
[
CFuncTypeArg
(
"self"
,
self
,
None
)]),
pos
=
None
,
defining
=
1
,
cname
=
"__Pyx_c_conj%s"
%
self
.
real_type
.
math_h_modifier
)
return
True
return
True
def
create_declaration_utility_code
(
self
,
env
):
def
create_declaration_utility_code
(
self
,
env
):
...
...
tests/run/complex_numbers_T305.pyx
View file @
6f060c90
...
@@ -58,9 +58,11 @@ __doc__ = u"""
...
@@ -58,9 +58,11 @@ __doc__ = u"""
>>> test_real_imag_assignment(1.5, -3.5)
>>> test_real_imag_assignment(1.5, -3.5)
(1.5-3.5j)
(1.5-3.5j)
## XXX not implemented yet!
>>> test_conjugate(2+3j)
## >>> test_conjugate(1+2j)
(2-3j)
## (1-2j)
>>> test_conjugate_double(2+3j)
(2-3j)
"""
"""
#cdef extern from "complex.h":
#cdef extern from "complex.h":
...
@@ -109,6 +111,8 @@ def test_real_imag_assignment(object a, double b):
...
@@ -109,6 +111,8 @@ def test_real_imag_assignment(object a, double b):
z
.
imag
=
b
z
.
imag
=
b
return
z
return
z
## XXX not implemented yet!
def
test_conjugate
(
float
complex
z
):
## def test_conjugate(float complex z):
return
z
.
conjugate
()
## return z.conjugate()
def
test_conjugate_double
(
double
complex
z
):
return
z
.
conjugate
()
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