| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 77654a7 commit f9fca92
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,49 @@ | |||
| 1 | + #ifndef COMPLEXOBJECT_H | ||
| 2 | + #define COMPLEXOBJECT_H | ||
| 3 | + #ifdef __cplusplus | ||
| 4 | + extern "C" { | ||
| 5 | + #endif | ||
| 6 | + | ||
| 7 | + /* Complex number structure */ | ||
| 8 | + | ||
| 9 | + typedef struct { | ||
| 10 | + double real; | ||
| 11 | + double imag; | ||
| 12 | + } complex; | ||
| 13 | + | ||
| 14 | + /* Operations on complex numbers from complexmodule.c */ | ||
| 15 | + | ||
| 16 | + extern complex c_sum(); | ||
| 17 | + extern complex c_diff(); | ||
| 18 | + extern complex c_neg(); | ||
| 19 | + extern complex c_prod(); | ||
| 20 | + extern complex c_quot(); | ||
| 21 | + extern complex c_pow(); | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + /* Complex object interface */ | ||
| 25 | + | ||
| 26 | + /* | ||
| 27 | + PyComplexObject represents a complex number with double-precision | ||
| 28 | + real and imaginary parts. | ||
| 29 | + */ | ||
| 30 | + | ||
| 31 | + typedef struct { | ||
| 32 | + PyObject_HEAD | ||
| 33 | + complex cval; | ||
| 34 | + } PyComplexObject; | ||
| 35 | + | ||
| 36 | + extern DL_IMPORT(PyTypeObject) PyComplex_Type; | ||
| 37 | + | ||
| 38 | + #define PyComplex_Check(op) ((op)->ob_type == &PyComplex_Type) | ||
| 39 | + | ||
| 40 | + extern PyObject *PyComplex_FromCComplex Py_PROTO((complex)); | ||
| 41 | + extern PyObject *PyComplex_FromDoubles Py_PROTO((double real, double imag)); | ||
| 42 | + | ||
| 43 | + extern double PyComplex_RealAsDouble Py_PROTO((PyObject *op)); | ||
| 44 | + extern double PyComplex_ImagAsDouble Py_PROTO((PyObject *op)); | ||
| 45 | + | ||
| 46 | + #ifdef __cplusplus | ||
| 47 | + } | ||
| 48 | + #endif | ||
| 49 | + #endif /* !COMPLEXOBJECT_H */ | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments