Branch Coverage

blib/lib/PDL/Algorithm/Center.pm
Criterion Covered Total %
branch 56 82 68.2


line true false branch
46 0 538 if $total_weight == 0
70 3 17 if defined $init_clip
78 0 20 if ($current->total_weight == 0)
106 5 525 if $iter->total_weight == 0
122 5 520 if ($current->sigma == $prev->sigma and PDL::all($current->center == $prev->center))
126 5 0 if defined $dtol
134 520 0 if (defined $dtol)
136 10 510 if $current->dist <= $dtol
150 0 0 if ($iter->iter == 0)
160 0 0 unless defined $iter->clip
466 24 54 unless builtin::blessed(my $object = ${$_[1];})
467 39 9 $object->dims == 0 ? :
48 0 $object->isa('PDL') ? :
6 48 defined $object->can('TO_JSON') ? :
490 3182 608 if $value->$PDL::Algorithm::Center::_isa("PDL")
531 0 23 if (defined $opt->{'log'} and not is_coderef($opt->log))
532 0 0 $opt->log ? :
540 21 2 if (defined $opt->{'coords'}) { }
1 1 elsif (defined $opt->{'weight'}) { }
545 35 6 unless defined $value
547 0 6 if $value->ndims != 1
553 2 4 if $nelem_c != $nelem_p
564 0 1 if (defined $opt->{'mask'})
565 0 0 if $opt->mask->shape != $opt->weight->shape
581 5 15 if (defined $opt->{'center'} and is_arrayref($opt->center)) { }
585 0 5 unless $icenter->nelem == $ndims
590 3 2 if ($defined->not->any)
1190 5 35 if defined $opt->{$_}
1192 3 17 defined $opt->weight ? :
1200 2 18 if (defined $opt->mask) { }
1212 13 7 if is_coderef($opt->center)
1215 0 20 unless &is_Piddle1D(scalar $opt->center) and $opt->center->nelem == $ndims
1243 5 15 unless eval { do { $opt->initialize->($opt->coords, $mask, $weight, $iteration[-1], $work); $opt->log->(&_new_iteration($iteration[-1])) if $opt->log; while (not $converged and ++$iteration <= $opt->iterlim) { my $prev = $iteration[-1]; my $current = &_new_iteration($prev); push @iteration, $current; ++$current->{'iter'}; $current->total_weight($total_weight); $current->nelem($nelem); $mask .= $opt->mask; $weight .= $opt->weight; $opt->calc_wmask->($opt->coords, $mask, $weight, $current, $work); $current->total_weight(($mask * $weight)->dsum) unless defined $current->total_weight; $current->nelem($mask->sum) unless defined $current->nelem; "PDL::Algorithm::Center::Failure::iteration::empty"->throw("no elements left after clip") if $current->nelem == 0; $current->center($opt->calc_center->($opt->coords, $mask, $weight, $current, $work)); $converged = $opt->is_converged->($opt->coords, $mask, $weight, $prev, $current, $work); $opt->log->(&_new_iteration($current)) if $opt->log; } ; 1 } }
1247 0 20 if $opt->log
1266 0 525 unless defined $current->total_weight
1268 0 525 unless defined $current->nelem
1271 0 525 if $current->nelem == 0
1278 0 525 if $opt->log
1283 0 20 if $iteration > $opt->iterlim
1288 0 20 $opt->save_mask ? :
0 20 $opt->save_weight ? :