Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyopencl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
pyopencl
Commits
29d900ec
Commit
29d900ec
authored
13 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Shift the docs around a bit.
parent
1263f881
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/source/array.rst
+36
-32
36 additions, 32 deletions
doc/source/array.rst
with
36 additions
and
32 deletions
doc/source/array.rst
+
36
−
32
View file @
29d900ec
...
@@ -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
-----------------------------------
-----------------------------------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment