Skip to content

Commit c22facd

Browse files
authored
Documentation overhaul (#444)
Finalizing doc updates for tensor, sptensor, and ktensor. Closes #422
1 parent 4b43e92 commit c22facd

26 files changed

+5634
-5107
lines changed

CONTRIBUTING.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ current or filing a new [issue](https://github.com/sandialabs/pyttb/issues).
7676
```
7777
1. For the CI version which is more strict
7878
```commandline
79-
sphinx-build ./docs/source ./docs/build -W -n --keep-going
79+
sphinx-build ./docs/source ./docs/build -E -W --keep-going
8080
```
8181
2. If not on Windows optionally add `-j auto` for parallelization
8282
2. Clear notebook outputs if run locally see `nbstripout` in our [pre-commit configuration](.pre-commit-config.yaml)
@@ -120,6 +120,14 @@ If you want to propose a change to Python Tensor Toolbox, follow these steps:
120120
1. **Update the Code**
121121
- Make the necessary updates in your local environment.
122122
- After making your changes, stage and commit them with an informative message.
123+
- Make sure that the order of methods in classes is consistent with other code in the repository. Specifically, the order should be the following (with methods in each section sorted alphabetically):
124+
1. `__slots__`
125+
1. `__init__`
126+
1. Property methods
127+
1. classmethods (prefixed with `@classmethod`)
128+
1. Public methods
129+
1. Dunder methods (prefixed and suffixed with double underscores `__`)
130+
1. Private methods (prefixed with an underscore `_`)
123131
124132
1. **Push your Changes and Create a Pull Request**
125133
- Push your changes to the new branch in your fork of the repository.

docs/source/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
# ones.
5151
extensions = [
5252
"sphinx.ext.autodoc",
53+
"sphinx_toolbox.more_autodoc.overloads",
5354
"sphinx.ext.intersphinx",
5455
"sphinx.ext.mathjax",
5556
"sphinx.ext.viewcode",
@@ -72,6 +73,7 @@
7273

7374
intersphinx_mapping = {
7475
"numpy": ("https://numpy.org/doc/stable/", None),
76+
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
7577
"python": ("http://docs.python.org/3.10/", None),
7678
"matplotlib": ("https://matplotlib.org/stable/", None),
7779
}
@@ -202,4 +204,4 @@
202204
# Autodoc settings
203205
autoclass_content = "class"
204206
autodoc_member_order = "bysource"
205-
autodoc_class_signature = "separated"
207+
autodoc_class_signature = "mixed"

docs/source/cpals.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
CP Alternating Least Squares (:obj:`cp_als`)
2-
============================================
3-
.. note::
4-
5-
The ``cp_als`` function defined in ``cp_als.py`` has been promoted to the ``pyttb`` namespace.
1+
CP Alternating Least Squares (:obj:`pyttb.cp_als`)
2+
==================================================
3+
4+
For *all* examples in this document, the following module imports are assumed::
5+
6+
>>> import pyttb as ttb
7+
>>> import numpy as np
68

79
.. autofunction:: pyttb.cp_als
810

docs/source/cpapr.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
CP Alternating Poisson Regression (:obj:`cp_apr`)
2-
=================================================
3-
.. note::
4-
5-
The ``cp_apr`` function defined in ``cp_apr.py`` has been promoted to the ``pyttb`` namespace.
1+
CP Alternating Poisson Regression (:obj:`pyttb.cp_apr`)
2+
=======================================================
3+
4+
For *all* examples in this document, the following module imports are assumed::
5+
6+
>>> import pyttb as ttb
7+
>>> import numpy as np
68

79
.. autofunction:: pyttb.cp_apr
810

docs/source/functionality.rst

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/source/gcpopt.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
Generalized CP Optimization (:obj:`pyttb.gcp_opt`)
22
==================================================
3-
.. note::
4-
5-
The ``gcp_opt`` function defined in ``gcp_opt.py`` has been promoted to the ``pyttb`` namespace.
3+
4+
For *all* examples in this document, the following module imports are assumed::
5+
6+
>>> import pyttb as ttb
7+
>>> import numpy as np
68

79
.. autofunction:: pyttb.gcp_opt
810

docs/source/hosvd.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
Tucker Higher-Order SVD (:obj:`hosvd`)
2-
======================================
3-
.. note::
4-
5-
The ``hosvd`` function defined in ``hosvd.py`` has been promoted to the ``pyttb`` namespace.
1+
Tucker Higher-Order SVD (:obj:`pyttb.hosvd`)
2+
============================================
63

4+
For *all* examples in this document, the following module imports are assumed::
5+
6+
>>> import pyttb as ttb
7+
>>> import numpy as np
78

89
.. autofunction:: pyttb.hosvd

docs/source/ktensor.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
Kruskal Tensor (:class:`ktensor`)
2-
---------------------------------
3-
.. note::
4-
5-
The ``ktensor`` class defined in ``ktensor.py`` has been promoted to the ``pyttb`` namespace.
1+
Kruskal Tensor (:class:`pyttb.ktensor`)
2+
=======================================
3+
4+
For *all* examples in this document, the following module imports are assumed::
5+
6+
>>> import pyttb as ttb
7+
>>> import numpy as np
68

79
.. autoclass:: pyttb.ktensor
810
:members:
911
:special-members:
10-
:exclude-members: __dict__, __weakref__, __slots__
11-
:show-inheritance:
12+
:exclude-members: __init__, __dict__, __weakref__, __deepcopy__

docs/source/pyttb_utils.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
Helper Functions (:mod:`pyttb_utils`, :mod:`khatrirao`)
2-
--------------------------------------------------------
1+
Helper Functions (:mod:`pyttb.pyttb_utils`, :mod:`pyttb.khatrirao`)
2+
===================================================================
33

4-
.. autofunction:: pyttb.khatrirao.khatrirao
4+
For *all* examples in this document, the following module imports are assumed::
5+
6+
>>> import pyttb as ttb
7+
>>> import numpy as np
58

69
.. automodule:: pyttb.pyttb_utils
710
:members:
811
:special-members:
912
:exclude-members: __dict__, __weakref__, __slots__
10-
:show-inheritance:
13+
:show-inheritance:
14+
15+
.. autofunction:: pyttb.khatrirao.khatrirao

docs/source/sptenmat.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
Sparse Tensor as Matrix (:class:`sptenmat`)
2-
-------------------------------------------
3-
.. note::
4-
5-
The ``sptenmat`` class defined in ``sptenmat.py`` has been promoted to the ``pyttb`` namespace.
1+
Sparse Tensor as Matrix (:class:`pyttb.sptenmat`)
2+
=================================================
3+
4+
For *all* examples in this document, the following module imports are assumed::
5+
6+
>>> import pyttb as ttb
7+
>>> import numpy as np
68

79
.. autoclass:: pyttb.sptenmat
810
:members:
911
:special-members:
10-
:exclude-members: __dict__, __weakref__, __slots__
12+
:exclude-members: __init__, __dict__, __weakref__, __deepcopy__
1113
:show-inheritance:

0 commit comments

Comments
 (0)