PDL Optimising Multitasking in PDL #12

update_idx_slice()

$state->update_total_iters();

if ($self->total_boards_solved() == $self->num_boards())
{
    $self->status("solved_all");
}
else
{
    $state->update_idx_slice();
}

sub update_idx_slice
{
    my $state = shift;
    my $r = $state->idx_slice()->copy();
    # $r cannot be 0, because the ones that were 0, were already solved
    # in $state->update_total_iters().
    $state->idx_slice() .=
        (($r > 0) * ($r - $state->quota())) +
        (($r < 0) * ($r                  ));
}
Copyright © 2005 Shlomi Fish