Skip to content

Commit ab5ac5c

Browse files
ntjohnson1dmdunla
andauthored
Start adding some more details to the coming from matlab docs (#352)
* Start adding some more details to the coming from matlab docs * MATLAB: Move the copying details to the top of the doc * This is a python detail so prefer referring outwards for more details. * DOCS: Generate docs for the pyttb_utils. They are mostly internal but it couldn't hurt to have them visible on the web hosted docs. --------- Co-authored-by: Danny Dunlavy <[email protected]>
1 parent 605dd28 commit ab5ac5c

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

docs/source/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ algorithms for computing low-rank tensor models.
2424

2525
pyttb supports multiple tensor types, including
2626
dense and sparse, as well as specially structured tensors, such as
27-
the Krusal format (stored as factor matrices).
27+
the Kruskal format (stored as factor matrices).
2828

2929
- `Algorithms`_
3030

docs/source/matlab/common.rst

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
General key differences
22
-----------------------
33

4+
Python Conventions
5+
^^^^^^^^^^^^^^^^^^
6+
We make extensive use of NumPy throughout the library so please see their
7+
`documentation for MATLAB users <https://numpy.org/doc/stable/user/numpy-for-matlab-users.html>`_.
8+
Otherwise some highlights are:
9+
10+
* 0-indexing in python vs 1-indexing in MATLAB
11+
12+
Copying
13+
^^^^^^^^^^^^^^^^^^^^
14+
Copying a ``pyttb`` tensor works differently than MATLAB. For example in MATLAB, copying a tensor ``Y``
15+
as ``Y = X`` returns a tensor ``Y`` that is independent of ``X``. Changing the value of ``Y`` does not
16+
change the value of ``X``. However, the same syntax in ``pyttb``, ``Y = X``, returns a *shallow copy* of ``X``;
17+
the shallow copy ``Y`` is a *reference* to ``X``. For that reason, each ``pyttb`` tensor class provides a ``copy()``
18+
method that returns a *deep copy* ``Y`` that is independent of ``X``, which is called as ``Y = X.copy()``.
19+
420
Data members
521
^^^^^^^^^^^^
622
+-----------------+----------------------+------------------------------------------------------------------------+
@@ -67,14 +83,6 @@ Methods
6783
| ``xor`` | ``logical_xor`` | ``X.logical_xor(Y)`` |
6884
+-----------------+----------------------+------------------------------------------------------------------------+
6985

70-
Copying
71-
^^^^^^^^^^^^^^^^^^^^
72-
Copying a ``pyttb`` tensor works differently than MATLAB. For example in MATLAB, copying a tensor ``Y``
73-
as ``Y = X`` returns a tensor ``Y`` that is independent of ``X``. Changing the value of ``Y`` does not
74-
change the value of ``X``. However, the same syntax in ``pyttb``, ``Y = X``, returns a *shallow copy* of ``X``;
75-
the shallow copy ``Y`` is a *reference* to ``X``. For that reason, each ``pyttb`` tensor class provides a ``copy()``
76-
method that returns a *deep copy* ``Y`` that is independent of ``X``, which is called as ``Y = X.copy()``.
77-
7886
MATLAB methods not included in ``pyttb``
7987
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8088
- ``datadisp``

docs/source/pyttb_utils.rst

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pyttb.pyttb_utils
2+
--------------------
3+
4+
.. automodule:: pyttb.pyttb_utils
5+
:members:
6+
:special-members:
7+
:exclude-members: __dict__, __weakref__, __slots__, __init__
8+
:show-inheritance:

docs/source/tensor_classes.rst

+1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ Tensor Classes
1111
tensor.rst
1212
ttensor.rst
1313
tenmat.rst
14+
pyttb_utils.rst
1415

0 commit comments

Comments
 (0)