def while_loop_condition(iteration, matrix, inactive, old_inactive): """Returns false if the while loop should terminate.""" del matrix # Needed by the body, but not the condition. not_done = (iteration < dimension) not_converged = standard_ops.reduce_any( standard_ops.not_equal(inactive, old_inactive)) return standard_ops.logical_and(not_done, not_converged)
def while_loop_condition(iteration, eigenvector, old_eigenvector): """Returns false if the while loop should terminate.""" not_done = (iteration < maximum_iterations) not_converged = (standard_ops.norm(eigenvector - old_eigenvector) > epsilon) return standard_ops.logical_and(not_done, not_converged)