Skip to content

Commit 7a8bc2d

Browse files
authored
replaced ortho()
1 parent a2c9d58 commit 7a8bc2d

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

scikit_tt/tensor_train.py

+3-21
Original file line numberDiff line numberDiff line change
@@ -1323,30 +1323,12 @@ def ortho(self, threshold: float=0, max_rank: Union[int, List[int]]=np.infty) ->
13231323
-------
13241324
TT
13251325
right-orthonormalized representation of self
1326-
1327-
Raises
1328-
------
1329-
ValueError
1330-
if threshold is less than 0
1331-
ValueError
1332-
if max_rank is not a positive integer
13331326
"""
13341327

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

1337-
if (isinstance(max_rank, (int, np.int32, np.int64)) and max_rank > 0) or max_rank == np.infty:
1338-
1339-
# left- and right-orthonormalize self
1340-
self.ortho_left(threshold=threshold, max_rank=np.infty).ortho_right(threshold=threshold,
1341-
max_rank=max_rank)
1342-
1343-
return self
1344-
1345-
else:
1346-
raise ValueError('Maximum rank must be a positive integer.')
1347-
1348-
else:
1349-
raise ValueError('Threshold must be greater or equal 0.')
1331+
return self
13501332

13511333
def norm(self, p: int=2) -> float:
13521334
"""

0 commit comments

Comments
 (0)