Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

complexobject.h 1.8 KB

You have to be logged in to leave a comment. Sign In
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  1. /* Complex number structure */
  2. #ifndef Py_COMPLEXOBJECT_H
  3. #define Py_COMPLEXOBJECT_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #ifndef Py_LIMITED_API
  8. typedef struct {
  9. double real;
  10. double imag;
  11. } Py_complex;
  12. /* Operations on complex numbers from complexmodule.c */
  13. PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex);
  14. PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex);
  15. PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex);
  16. PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex);
  17. PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex);
  18. PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex);
  19. PyAPI_FUNC(double) _Py_c_abs(Py_complex);
  20. #endif
  21. /* Complex object interface */
  22. /*
  23. PyComplexObject represents a complex number with double-precision
  24. real and imaginary parts.
  25. */
  26. #ifndef Py_LIMITED_API
  27. typedef struct {
  28. PyObject_HEAD
  29. Py_complex cval;
  30. } PyComplexObject;
  31. #endif
  32. PyAPI_DATA(PyTypeObject) PyComplex_Type;
  33. #define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
  34. #define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type)
  35. #ifndef Py_LIMITED_API
  36. PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex);
  37. #endif
  38. PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag);
  39. PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op);
  40. PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op);
  41. #ifndef Py_LIMITED_API
  42. PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op);
  43. #endif
  44. /* Format the object based on the format_spec, as defined in PEP 3101
  45. (Advanced String Formatting). */
  46. #ifndef Py_LIMITED_API
  47. PyAPI_FUNC(int) _PyComplex_FormatAdvancedWriter(
  48. _PyUnicodeWriter *writer,
  49. PyObject *obj,
  50. PyObject *format_spec,
  51. Py_ssize_t start,
  52. Py_ssize_t end);
  53. #endif
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif /* !Py_COMPLEXOBJECT_H */
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...