Skip to content

Commit

Permalink
Merge branch 'main' into 230-tutorial-gcp_opt
Browse files Browse the repository at this point in the history
  • Loading branch information
dmdunla committed Sep 27, 2023
2 parents b4a5658 + fa50da9 commit 66847d3
Show file tree
Hide file tree
Showing 2 changed files with 209 additions and 91 deletions.
75 changes: 39 additions & 36 deletions pyttb/cp_apr.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def cp_apr( # noqa: PLR0913
kappatol,
)
output["algorithm"] = "mu"
output["params"]["algorithm"] = "mu"
elif algorithm.lower() == "pdnr":
M, output = tt_cp_apr_pdnr(
input_tensor,
Expand All @@ -160,6 +161,7 @@ def cp_apr( # noqa: PLR0913
inexact,
)
output["algorithm"] = "pdnr"
output["params"]["algorithm"] = "pdnr"
elif algorithm.lower() == "pqnr":
M, output = tt_cp_apr_pqnr(
input_tensor,
Expand All @@ -177,6 +179,7 @@ def cp_apr( # noqa: PLR0913
precompinds,
)
output["algorithm"] = "pqnr"
output["params"]["algorithm"] = "pqnr"
else:
assert False, "{algorithm} is not a supported cp_als algorithm"

Expand Down Expand Up @@ -362,17 +365,17 @@ def tt_cp_apr_mu( # noqa: PLR0912,PLR0913,PLR0915
print(f" Total execution time = {t_stop} secs")

output = {
"params": (
stoptol,
stoptime,
maxiters,
maxinneriters,
epsDivZero,
printitn,
printinneritn,
kappa,
kappatol,
),
"params": {
"stoptol": stoptol,
"stoptime": stoptime,
"maxiters": maxiters,
"maxinneriters": maxinneriters,
"epsDivZero": epsDivZero,
"printitn": printitn,
"printinneritn": printinneritn,
"kappa": kappa,
"kappatol": kappatol,
},
"kktViolations": kktViolations[: iteration + 1],
"nInnerIters": nInnerIters[: iteration + 1],
"nViolations": nViolations[: iteration + 1],
Expand Down Expand Up @@ -712,19 +715,19 @@ def tt_cp_apr_pdnr( # noqa: PLR0912,PLR0913,PLR0915
print(f" Total execution time = {t_stop} secs")

output = {
"params": (
stoptol,
stoptime,
maxiters,
maxinneriters,
epsDivZero,
printitn,
printinneritn,
epsActive,
mu0,
precompinds,
inexact,
),
"params": {
"stoptol": stoptol,
"stoptime": stoptime,
"maxiters": maxiters,
"maxinneriters": maxinneriters,
"epsDivZero": epsDivZero,
"printitn": printitn,
"printinneritn": printinneritn,
"epsActive": epsActive,
"mu0": mu0,
"precompinds": precompinds,
"inexact": inexact,
},
"kktViolations": kktViolations[: iteration + 1],
"obj": obj,
"fnEvals": fnEvals[: iteration + 1],
Expand Down Expand Up @@ -1105,18 +1108,18 @@ def tt_cp_apr_pqnr( # noqa: PLR0912,PLR0913,PLR0915
print(f" Total execution time = {t_stop} secs")

output = {
"params": (
stoptol,
stoptime,
maxiters,
maxinneriters,
epsDivZero,
printitn,
printinneritn,
epsActive,
lbfgsMem,
precompinds,
),
"params": {
"stoptol": stoptol,
"stoptime": stoptime,
"maxiters": maxiters,
"maxinneriters": maxinneriters,
"epsDivZero": epsDivZero,
"printitn": printitn,
"printinneritn": printinneritn,
"epsActive": epsActive,
"lbfgsMem": lbfgsMem,
"precompinds": precompinds,
},
"kktViolations": kktViolations[: iteration + 1],
"obj": obj,
"fnEvals": fnEvals[: iteration + 1],
Expand Down
Loading

0 comments on commit 66847d3

Please sign in to comment.