Skip to content

Commit

Permalink
replaced ortho()
Browse files Browse the repository at this point in the history
  • Loading branch information
PGelss authored Jul 17, 2024
1 parent a2c9d58 commit 7a8bc2d
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions scikit_tt/tensor_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -1323,30 +1323,12 @@ def ortho(self, threshold: float=0, max_rank: Union[int, List[int]]=np.infty) ->
-------
TT
right-orthonormalized representation of self
Raises
------
ValueError
if threshold is less than 0
ValueError
if max_rank is not a positive integer
"""

if isinstance(threshold, (int, np.int32, np.int64, float, np.float32, np.float64)) and threshold >= 0:
# left- and right-orthonormalize self
self.ortho_left(threshold=threshold, max_rank=np.infty).ortho_right(threshold=threshold, max_rank=max_rank)

if (isinstance(max_rank, (int, np.int32, np.int64)) and max_rank > 0) or max_rank == np.infty:

# left- and right-orthonormalize self
self.ortho_left(threshold=threshold, max_rank=np.infty).ortho_right(threshold=threshold,
max_rank=max_rank)

return self

else:
raise ValueError('Maximum rank must be a positive integer.')

else:
raise ValueError('Threshold must be greater or equal 0.')
return self

def norm(self, p: int=2) -> float:
"""
Expand Down

0 comments on commit 7a8bc2d

Please sign in to comment.