Skip to content

Commit

Permalink
Small fix for rank truncation
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiChertkov committed Jul 24, 2023
1 parent 6d250d2 commit 3cb5d0b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ttopt/ttopt_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def ttopt(f, n, rank=5, evals=None, Y0=None, seed=42, fs_opt=1.,
else:
J_list = J0
r = [1] + [J.shape[0] for J in J_list[1:-1]] + [1]
for i in range(1, d):
r[i] = min(rank, n[i-1] * r[i-1])

i_opt = None # Approximation of argmin /argmax for tensor
y_opt = None # Approximation of optimum for tensor (float('inf'))
Expand Down Expand Up @@ -192,7 +194,7 @@ def ttopt_init(n, rank, Y0=None, seed=42, with_rank=False):
r.append(1)

rng = np.random.default_rng(seed)

if Y0 is None:
Y0 = [rng.normal(size=(r[i], n[i], r[i + 1])) for i in range(d)]

Expand Down

0 comments on commit 3cb5d0b

Please sign in to comment.