def attributes_known(self):
if self.scope is None:
import Symtab
- self.scope = Symtab.StructOrUnionScope(self.specalization_name())
- self.scope.declare_var("real", self.real_type, None, "real")
- self.scope.declare_var("imag", self.real_type, None, "imag")
+ self.scope = scope = Symtab.CClassScope(
+ '',
+ 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
def create_declaration_utility_code(self, env):
>>> test_real_imag_assignment(1.5, -3.5)
(1.5-3.5j)
-## XXX not implemented yet!
-## >>> test_conjugate(1+2j)
-## (1-2j)
+ >>> test_conjugate(2+3j)
+ (2-3j)
+
+ >>> test_conjugate_double(2+3j)
+ (2-3j)
"""
#cdef extern from "complex.h":
z.imag = b
return z
-## XXX not implemented yet!
-## def test_conjugate(float complex z):
-## return z.conjugate()
+def test_conjugate(float complex z):
+ return z.conjugate()
+
+def test_conjugate_double(double complex z):
+ return z.conjugate()