Skip to content

Commit

Permalink
New params-returns format.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vital-Fernandez committed May 15, 2018
1 parent 39f47af commit 86d40b3
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 7 deletions.
4 changes: 2 additions & 2 deletions doc/gumath/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
Mathematical operations
=======================

The gumath functions provide a python wrapper for the libgumath library. The sine operation is currently the
only one available.
The gumath functions provide a python wrapper for the libgumath library. The operations currently available are
sine and cosine.

Trigonometry functions
----------------------
Expand Down
44 changes: 40 additions & 4 deletions doc/gumath/trigonometry/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@

.. sectionauthor:: Vital Fernandez <vital-fernandez at gmail.com>


.. _sin-reference-label:
sin
===

Trigonometric sine, element-wise.
Trigonometric sine, element-wise. See :ref:`sin-reference-label`.

:param x: Array like

:returns: Angle in radians (2*pi rad equals 360 degrees)

Parameters
----------
Expand All @@ -35,7 +39,39 @@ Example

>>> import gumath as gm
>>> from xnd import xnd
>>> x = [0.0, 30 * 3.14159/180, 90 * 3.14159/180]
>>> x = [0.0, 45 * 3.14159/180, 90 * 3.14159/180]
>>> gm.sin(xnd(x))
xnd([0.0, 0.49999, 0.99999], type='3 * float64')
xnd([0.0, 0.70710, 0.99999], type='3 * float64')

cos
===

Trigonometric cosine, element-wise.

Parameters
----------

Atributes
^^^^^^^^^

x: array_like
Angle, in radians (2*pi rad equals 360 degrees).

Returns
^^^^^^^

y: array_like
The cosine of each element of x.

returns: array:like

Example
-------

.. doctest::

>>> import gumath as gm
>>> from xnd import xnd
>>> x = [0.0, 45 * 3.14159/180, 90 * 3.14159/180]
>>> gm.cos(xnd(x))
xnd([1.0, 0.70710, 6.12323e-17], type='3 * float64')
2 changes: 1 addition & 1 deletion doc/libgumath/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This initial libgumath version displays a simple design. The goal is
to determine whether the kernel signatures and the dispatch model are suitable
for Numba.

Currently there is just one working test with sin().
Currently the only functions available are sine and cosine.

.. toctree::

Expand Down
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ def make_symlinks():
env['PYTHONPATH'] = path
ret = subprocess.call([sys.executable, "python/test_gumath.py"], env=env)
sys.exit(ret)
elif sys.argv[1] == 'doctest':
module_path = '../python'
python_path = os.getenv('PYTHONPATH')
path = module_path + ':' + python_path if python_path else module_path
env = os.environ.copy()
env['PYTHONPATH'] = path
ret = subprocess.call(["make", "doctest"], cwd='doc', env=env)
sys.exit(ret)
elif sys.argv[1] == 'clean':
shutil.rmtree("build", ignore_errors=True)
os.chdir("python/gumath")
Expand Down

0 comments on commit 86d40b3

Please sign in to comment.