@@ -313,7 +313,7 @@ def tt_cp_apr_mu( # noqa: PLR0912,PLR0913,PLR0915
313
313
M .factor_matrices [n ] *= Phi [n ]
314
314
315
315
# Print status
316
- if printinneritn != 0 and divmod (i , printinneritn )[1 ] == 0 :
316
+ if ( printinneritn > 0 ) and ( divmod (i , printinneritn )[1 ] == 0 ) :
317
317
print (
318
318
"\t \t Mode = {n}, Inner Iter = {i}, "
319
319
f"KKT violation = { kktModeViolations [n ]} "
@@ -323,7 +323,7 @@ def tt_cp_apr_mu( # noqa: PLR0912,PLR0913,PLR0915
323
323
M .normalize (normtype = 1 , mode = n )
324
324
325
325
kktViolations [iteration ] = np .max (kktModeViolations )
326
- if divmod (iteration , printitn )[1 ] == 0 :
326
+ if ( printitn > 0 ) and ( divmod (iteration , printitn )[1 ] == 0 ) :
327
327
print (
328
328
f"\t Iter { iteration } : Inner Its = { nInnerIters [iteration ]} "
329
329
f"KKT violation = { kktViolations [iteration ]} , "
@@ -588,7 +588,7 @@ def tt_cp_apr_pdnr( # noqa: PLR0912,PLR0913,PLR0915
588
588
if i == 0 and kkt_violation > kktModeViolations [n ]:
589
589
kktModeViolations [n ] = kkt_violation
590
590
591
- if printinneritn > 0 and np . mod ( i , printinneritn ) == 0 :
591
+ if ( printinneritn > 0 ) and ( divmod ( i , printinneritn ) == 0 ) :
592
592
print (
593
593
f"\t Mode = { n } , Row = { jj } , InnerIt = { i } " ,
594
594
end = "" ,
@@ -675,7 +675,7 @@ def tt_cp_apr_pdnr( # noqa: PLR0912,PLR0913,PLR0915
675
675
rowsubprobStopTol = np .maximum (stoptol , kktViolations [iteration ]) / 100.0
676
676
677
677
# Print outer iteration status.
678
- if printitn > 0 and np . mod ( iteration , printitn ) == 0 :
678
+ if ( printitn > 0 ) and ( divmod ( iteration , printitn )[ 1 ] == 0 ) :
679
679
fnVals [iteration ] = - tt_loglikelihood (input_tensor , M )
680
680
print (
681
681
f"{ iteration } . Ttl Inner Its: { nInnerIters [iteration ]} , "
@@ -966,7 +966,7 @@ def tt_cp_apr_pqnr( # noqa: PLR0912,PLR0913,PLR0915
966
966
if i == 0 and kkt_violation > kktModeViolations [n ]:
967
967
kktModeViolations [n ] = kkt_violation
968
968
969
- if printinneritn > 0 and np . mod ( i , printinneritn ) == 0 :
969
+ if ( printinneritn > 0 ) and ( divmod ( i , printinneritn ) == 0 ) :
970
970
print (
971
971
f"\t Mode = { n } , Row = { jj } , InnerIt = { i } " ,
972
972
end = "" ,
@@ -1073,7 +1073,7 @@ def tt_cp_apr_pqnr( # noqa: PLR0912,PLR0913,PLR0915
1073
1073
kktViolations [iteration ] = np .max (kktModeViolations )
1074
1074
1075
1075
# Print outer iteration status.
1076
- if printitn > 0 and np . mod ( iteration , printitn ) == 0 :
1076
+ if ( printitn > 0 ) and ( divmod ( iteration , printitn )[ 1 ] == 0 ) :
1077
1077
fnVals [iteration ] = - tt_loglikelihood (input_tensor , M )
1078
1078
print (
1079
1079
f"{ iteration } . Ttl Inner Its: { nInnerIters [iteration ]} , KKT viol = "
0 commit comments