Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal docs for complex number support #628

Open
wants to merge 2 commits into
base: release_1.0.9
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions doc/guide/plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,9 @@ shapes for its calculation, so the volume fraction parameter in the model
is automatically scaled by *form_volume/shell_volume* prior to calling the
structure factor.

Special functions for scattering such as $3j_1(x)/x$ are available. See
:mod:`sasmodels.special` for details.

Embedded C Models
.................

Expand Down Expand Up @@ -1034,7 +1037,41 @@ file in the order given, otherwise these functions will not be available.
:code:`source = ["lib/gauss76.c", ...]`
(`gauss76.c <https://github.com/SasView/sasmodels/tree/master/sasmodels/models/lib/gauss76.c>`_)

Many of these functions are also available in :mod:`sasmodels.special` for
models implemented in python.

Complex numbers
...............

A small complex number library is available using :code:`source = ["lib/cl_complex.h", ...]`.
Numbers are defined as type cdouble, which can be passed to and returned from
functions. Operations are as follows:

| declare: cdouble x
| define: cplx(real, imag)
| x.real: creal(x)
| x.imag: cimag(x)
| 1j: I
| real + x: radd(real, x)
| real - x: rsub(real, x)
| real * x: rmul(real, x)
| real / x: rdiv(real, x)
| x + real: radd(real, x)
| x - real: radd(-real, x)
| x * real: rmul(real, x)
| x / real: rmul(1.0/real, x)
| x + y: cadd(x, y)
| x - y: csub(x, y)
| x * y: cmul(x, y)
| x / y: cdiv(x, y)
| -x: cneg(x)
| abs(x): cabs(x)
| angle(x): carg(x)
|
| special functions:
| csqrt, cexp, cpow, clog, clog10
| csin, ccos, ctan
| csinh, ccosh, ctanh

Problems with C models
......................
Expand Down
Loading