Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20 tensor complete documentation for all methods #218

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/ktensor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ pyttb.ktensor
.. autoclass:: pyttb.ktensor
:members:
:special-members:
:exclude-members: __dict__,__weakref__, __slots__, __init__
:exclude-members: __dict__, __weakref__, __slots__, __init__
:show-inheritance:
4 changes: 2 additions & 2 deletions docs/source/sptensor.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pyttb.sptensor
----------------------

.. automodule:: pyttb.sptensor
.. autoclass:: pyttb.sptensor
:members:
:special-members:
:exclude-members: __dict__,__weakref__, __slots__, __init__
:exclude-members: __dict__, __weakref__, __slots__, __init__
:show-inheritance:
2 changes: 1 addition & 1 deletion docs/source/tenmat.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pyttb.tenmat
====================

.. automodule:: pyttb.tenmat
.. autoclass:: pyttb.tenmat
:members:
:special-members:
:exclude-members: __dict__, __weakref__, __slots__, __init__
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tensor.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pyttb.tensor
--------------------

.. automodule:: pyttb.tensor
.. autoclass:: pyttb.tensor
:members:
:special-members:
:exclude-members: __dict__, __weakref__, __slots__, __init__
Expand Down
2 changes: 1 addition & 1 deletion docs/source/ttensor.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pyttb.ttensor
--------------------

.. automodule:: pyttb.ttensor
.. autoclass:: pyttb.ttensor
:members:
:special-members:
:exclude-members: __dict__, __weakref__, __slots__, __init__
Expand Down
9 changes: 4 additions & 5 deletions pyttb/ktensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ class ktensor:
dimension i and r is the rank of the tensor (as well as the length of the
weights vector).

Although the constructor `__init__()` can be used to create an empty
:class:`pyttb.ktensor`, there are several class methods that can be used
to create an instance of this class:
Instances of :class:`pyttb.ktensor` can be created using `__init__()` or
one of the following methods:

* :meth:`from_function`
* :meth:`from_vector`
Expand Down Expand Up @@ -1279,11 +1278,11 @@ def normalize(

def nvecs(self, n: int, r: int, flipsign: bool = True) -> np.ndarray:
"""
Compute the leading mode-n vectors for a :class:`pyttb.ktensor`.
Compute the leading mode-n vectors of the ktensor.

Computes the `r` leading eigenvectors of Xn*Xn.T (where Xn is the
mode-`n` matricization/unfolding of self), which provides information
about the mode-N fibers. In two-dimensions, the `r` leading mode-1
about the mode-n fibers. In two-dimensions, the `r` leading mode-1
vectors are the same as the `r` left singular vectors and the `r`
leading mode-2 vectors are the same as the `r` right singular
vectors. By default, this method computes the top `r` eigenvectors
Expand Down
3 changes: 1 addition & 2 deletions pyttb/sptensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2511,15 +2511,14 @@ def __repr__(self): # pragma: no cover
return s

s = f"Sparse tensor of shape {self.shape}"
s += f" with {nz} nonzeros \n"
s += f" with {nz} nonzeros\n"

# Stop insane printouts
if nz > 10000:
r = input("Are you sure you want to print all nonzeros? (Y/N)")
if r.upper() != "Y":
return s
for i in range(0, self.subs.shape[0]):
s += "\t"
s += "["
idx = self.subs[i, :]
s += str(idx.tolist())[1:]
Expand Down
Loading