Skip to content
Snippets Groups Projects
Commit 29d900ec authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Shift the docs around a bit.

parent 1263f881
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,42 @@ about them using this function: ...@@ -34,6 +34,42 @@ about them using this function:
.. versionadded: 2011.2 .. versionadded: 2011.2
Complex Numbers
^^^^^^^^^^^^^^^
PyOpenCL's :class:`Array` type supports complex numbers out of the box, by
simply using the corresponding :mod:`numpy` types.
If you would like to use this support in your own kernels, here's how to
proceed: Since OpenCL 1.2 (and earlier) do not specify native complex number
support, PyOpenCL works around that deficiency. By saying::
#include <pyopencl-complex.h>
in your kernel, you get complex types `cfloat_t` and `cdouble_t`, along with
functions defined on them such as `cfloat_mul(a, b)` or `cdouble_log(z)`.
Elementwise kernels automatically include the header if your kernel has
complex input or output.
See the `source file
<https://github.com/inducer/pyopencl/blob/master/src/cl/pyopencl-complex.h>`_
for a precise list of what's available.
If you need double precision support, please::
#define PYOPENCL_DEFINE_CDOUBLE
before including the header, as DP support apparently cannot be reliably
autodetected.
Under the hood, the complex types are simply `float2` and `double2`.
.. warning::
Note that addition (real + complex) and multiplication (complex*complex)
are defined for e.g. `float2`, but yield wrong results, so that you need to
use the corresponding functions.
.. versionadded:: 2012.1
The :class:`Array` Class The :class:`Array` Class
------------------------ ------------------------
...@@ -398,38 +434,6 @@ functions available in the OpenCL standard. (See table 6.8 in the spec.) ...@@ -398,38 +434,6 @@ functions available in the OpenCL standard. (See table 6.8 in the spec.)
.. function:: tgamma(array, queue=None) .. function:: tgamma(array, queue=None)
.. function:: trunc(array, queue=None) .. function:: trunc(array, queue=None)
Complex Numbers
---------------
Since OpenCL 1.2 (and earlier) do not specify native complex number support,
PyOpenCL works around that deficiency. By saying::
#include <pyopencl-complex.h>
in your kernel, you get complex types `cfloat_t` and `cdouble_t`, along with
functions defined on them such as `cfloat_mul(a, b)` or `cdouble_log(z)`.
Elementwise kernels automatically include the header if your kernel has
complex input or output.
See the `source file
<https://github.com/inducer/pyopencl/blob/master/src/cl/pyopencl-complex.h>`_
for a precise list of what's available.
If you need double precision support, please::
#define PYOPENCL_DEFINE_CDOUBLE
before including the header, as DP support apparently cannot be reliably
autodetected.
Under the hood, the complex types are simply `float2` and `double2`.
.. warning::
Note that addition (real + complex) and multiplication (complex*complex)
are defined for e.g. `float2`, but yield wrong results, so that you need to
use the corresponding functions.
.. versionadded:: 2012.1
Generating Arrays of Random Numbers Generating Arrays of Random Numbers
----------------------------------- -----------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment