|
1 | 1 | General key differences
|
2 | 2 | -----------------------
|
3 | 3 |
|
| 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 | + |
4 | 20 | Data members
|
5 | 21 | ^^^^^^^^^^^^
|
6 | 22 | +-----------------+----------------------+------------------------------------------------------------------------+
|
@@ -67,14 +83,6 @@ Methods
|
67 | 83 | | ``xor`` | ``logical_xor`` | ``X.logical_xor(Y)`` |
|
68 | 84 | +-----------------+----------------------+------------------------------------------------------------------------+
|
69 | 85 |
|
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 |
| - |
78 | 86 | MATLAB methods not included in ``pyttb``
|
79 | 87 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
80 | 88 | - ``datadisp``
|
|
0 commit comments