Skip to content

Commit

Permalink
Minimal docs for complex number support. Fixes #589
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Kienzle committed Jan 21, 2025
1 parent ff1980a commit f69e836
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions doc/guide/plugin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,38 @@ 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>`_)

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

0 comments on commit f69e836

Please sign in to comment.