@@ -313,7 +313,7 @@ def tt_cp_apr_mu( # noqa: PLR0912,PLR0913,PLR0915
313313 M .factor_matrices [n ] *= Phi [n ]
314314
315315 # Print status
316- if printinneritn != 0 and divmod (i , printinneritn )[1 ] == 0 :
316+ if ( printinneritn > 0 ) and ( divmod (i , printinneritn )[1 ] == 0 ) :
317317 print (
318318 "\t \t Mode = {n}, Inner Iter = {i}, "
319319 f"KKT violation = { kktModeViolations [n ]} "
@@ -323,7 +323,7 @@ def tt_cp_apr_mu( # noqa: PLR0912,PLR0913,PLR0915
323323 M .normalize (normtype = 1 , mode = n )
324324
325325 kktViolations [iteration ] = np .max (kktModeViolations )
326- if divmod (iteration , printitn )[1 ] == 0 :
326+ if ( printitn > 0 ) and ( divmod (iteration , printitn )[1 ] == 0 ) :
327327 print (
328328 f"\t Iter { iteration } : Inner Its = { nInnerIters [iteration ]} "
329329 f"KKT violation = { kktViolations [iteration ]} , "
@@ -588,7 +588,7 @@ def tt_cp_apr_pdnr( # noqa: PLR0912,PLR0913,PLR0915
588588 if i == 0 and kkt_violation > kktModeViolations [n ]:
589589 kktModeViolations [n ] = kkt_violation
590590
591- if printinneritn > 0 and np . mod ( i , printinneritn ) == 0 :
591+ if ( printinneritn > 0 ) and ( divmod ( i , printinneritn ) == 0 ) :
592592 print (
593593 f"\t Mode = { n } , Row = { jj } , InnerIt = { i } " ,
594594 end = "" ,
@@ -675,7 +675,7 @@ def tt_cp_apr_pdnr( # noqa: PLR0912,PLR0913,PLR0915
675675 rowsubprobStopTol = np .maximum (stoptol , kktViolations [iteration ]) / 100.0
676676
677677 # Print outer iteration status.
678- if printitn > 0 and np . mod ( iteration , printitn ) == 0 :
678+ if ( printitn > 0 ) and ( divmod ( iteration , printitn )[ 1 ] == 0 ) :
679679 fnVals [iteration ] = - tt_loglikelihood (input_tensor , M )
680680 print (
681681 f"{ iteration } . Ttl Inner Its: { nInnerIters [iteration ]} , "
@@ -966,7 +966,7 @@ def tt_cp_apr_pqnr( # noqa: PLR0912,PLR0913,PLR0915
966966 if i == 0 and kkt_violation > kktModeViolations [n ]:
967967 kktModeViolations [n ] = kkt_violation
968968
969- if printinneritn > 0 and np . mod ( i , printinneritn ) == 0 :
969+ if ( printinneritn > 0 ) and ( divmod ( i , printinneritn ) == 0 ) :
970970 print (
971971 f"\t Mode = { n } , Row = { jj } , InnerIt = { i } " ,
972972 end = "" ,
@@ -1073,7 +1073,7 @@ def tt_cp_apr_pqnr( # noqa: PLR0912,PLR0913,PLR0915
10731073 kktViolations [iteration ] = np .max (kktModeViolations )
10741074
10751075 # Print outer iteration status.
1076- if printitn > 0 and np . mod ( iteration , printitn ) == 0 :
1076+ if ( printitn > 0 ) and ( divmod ( iteration , printitn )[ 1 ] == 0 ) :
10771077 fnVals [iteration ] = - tt_loglikelihood (input_tensor , M )
10781078 print (
10791079 f"{ iteration } . Ttl Inner Its: { nInnerIters [iteration ]} , KKT viol = "
0 commit comments