slices.pd (PDL-2.081) | : | slices.pd (PDL-2.082) | ||
---|---|---|---|---|
skipping to change at line 2036 | skipping to change at line 2036 | |||
i == $PDL(PARENT)->broadcastids[$COMP(id])) { | i == $PDL(PARENT)->broadcastids[$COMP(id])) { | |||
nthc += $COMP(whichdims_count); | nthc += $COMP(whichdims_count); | |||
} | } | |||
for(j=0; j<$COMP(whichdims_count); j++) { | for(j=0; j<$COMP(whichdims_count); j++) { | |||
if($COMP(whichdims[j] == i)) {flag=1; break;} | if($COMP(whichdims[j] == i)) {flag=1; break;} | |||
} | } | |||
if(flag) { | if(flag) { | |||
continue; | continue; | |||
} | } | |||
$PDL(CHILD)->dims[nthc] = $PDL(PARENT)->dims[i]; | $PDL(CHILD)->dims[nthc] = $PDL(PARENT)->dims[i]; | |||
$PRIV(incs[nthc]) = $PDL(PARENT)->dimincs[i]; | $PRIV(incs)[nthc] = $PDL(PARENT)->dimincs[i]; | |||
nthc++; | nthc++; | |||
} | } | |||
for(i=0; i<$COMP(whichdims_count); i++) { | for(i=0; i<$COMP(whichdims_count); i++) { | |||
PDL_Indx cdim,pdim; | PDL_Indx cdim,pdim; | |||
cdim = i + | cdim = i + | |||
($PDL(PARENT)->nbroadcastids > $COMP(id) && $COMP(id) > = 0? | ($PDL(PARENT)->nbroadcastids > $COMP(id) && $COMP(id) > = 0? | |||
$PDL(PARENT)->broadcastids[$COMP(id)] : $PDL(PARENT)-> ndims) | $PDL(PARENT)->broadcastids[$COMP(id)] : $PDL(PARENT)-> ndims) | |||
- $COMP(nrealwhichdims); | - $COMP(nrealwhichdims); | |||
pdim = $COMP(whichdims[i]); | pdim = $COMP(whichdims[i]); | |||
if(pdim == -1) { | if(pdim == -1) { | |||
$PDL(CHILD)->dims[cdim] = 1; | $PDL(CHILD)->dims[cdim] = 1; | |||
$PRIV(incs[cdim]) = 0; | $PRIV(incs)[cdim] = 0; | |||
} else { | } else { | |||
$PDL(CHILD)->dims[cdim] = $PDL(PARENT)->dims[pdi m]; | $PDL(CHILD)->dims[cdim] = $PDL(PARENT)->dims[pdi m]; | |||
$PRIV(incs[cdim]) = $PDL(PARENT)->dimincs[pdim]; | $PRIV(incs)[cdim] = $PDL(PARENT)->dimincs[pdim]; | |||
} | } | |||
} | } | |||
$SETDIMS(); | $SETDIMS(); | |||
PDL_RETERROR(PDL_err, PDL->reallocbroadcastids($PDL(CHILD), | PDL_RETERROR(PDL_err, PDL->reallocbroadcastids($PDL(CHILD), | |||
PDLMAX($COMP(id)+1, $PDL(PARENT)->nbroadcastids) )); | PDLMAX($COMP(id)+1, $PDL(PARENT)->nbroadcastids) )); | |||
for(i=0; i<$PDL(CHILD)->nbroadcastids-1; i++) { | for(i=0; i<$PDL(CHILD)->nbroadcastids-1; i++) { | |||
$PDL(CHILD)->broadcastids[i] = | $PDL(CHILD)->broadcastids[i] = | |||
($PDL(PARENT)->nbroadcastids > i ? | ($PDL(PARENT)->nbroadcastids > i ? | |||
$PDL(PARENT)->broadcastids[i] : $PDL(PARENT)->ndims) + | $PDL(PARENT)->broadcastids[i] : $PDL(PARENT)->ndims) + | |||
(i <= $COMP(id) ? - $COMP(nrealwhichdims) : | (i <= $COMP(id) ? - $COMP(nrealwhichdims) : | |||
skipping to change at line 2097 | skipping to change at line 2097 | |||
for(i=0; i<$PDL(PARENT)->ndims; i++) { | for(i=0; i<$PDL(PARENT)->ndims; i++) { | |||
PDL_Indx corc; | PDL_Indx corc; | |||
if(i<$COMP(atind)) { | if(i<$COMP(atind)) { | |||
corc = i; | corc = i; | |||
} else if(i < $PDL(PARENT)->broadcastids[0]) { | } else if(i < $PDL(PARENT)->broadcastids[0]) { | |||
corc = i + $PDL(PARENT)->ndims-$PDL(PARENT)->bro adcastids[0]; | corc = i + $PDL(PARENT)->ndims-$PDL(PARENT)->bro adcastids[0]; | |||
} else { | } else { | |||
corc = i - $PDL(PARENT)->broadcastids[0] + $COMP (atind); | corc = i - $PDL(PARENT)->broadcastids[0] + $COMP (atind); | |||
} | } | |||
$PDL(CHILD)->dims[corc] = $PDL(PARENT)->dims[i]; | $PDL(CHILD)->dims[corc] = $PDL(PARENT)->dims[i]; | |||
$PRIV(incs[corc]) = $PDL(PARENT)->dimincs[i]; | $PRIV(incs)[corc] = $PDL(PARENT)->dimincs[i]; | |||
} | } | |||
$SETDIMS(); | $SETDIMS(); | |||
', | ', | |||
); | ); | |||
pp_add_exported('', 'dice dice_axis'); | pp_add_exported('', 'dice dice_axis'); | |||
pp_addpm(<<'EOD'); | pp_addpm(<<'EOD'); | |||
=head2 dice | =head2 dice | |||
skipping to change at line 2526 | skipping to change at line 2526 | |||
/** Belt-and-suspenders **/ | /** Belt-and-suspenders **/ | |||
if( ($COMP(idim[i]) < 0) && ($COMP(odim[i]) < 0) ) { | if( ($COMP(idim[i]) < 0) && ($COMP(odim[i]) < 0) ) { | |||
PDL->changed($PDL(CHILD), PDL_PARENTDIMSCHANGED, 0); | PDL->changed($PDL(CHILD), PDL_PARENTDIMSCHANGED, 0); | |||
$CROAK("Hmmm, both dummy and squished -- this can never happen. I quit."); | $CROAK("Hmmm, both dummy and squished -- this can never happen. I quit."); | |||
} | } | |||
/** First handle dummy dims since there's no input from th e parent **/ | /** First handle dummy dims since there's no input from th e parent **/ | |||
if( $COMP(idim[i]) < 0 ) { | if( $COMP(idim[i]) < 0 ) { | |||
/* dummy dim - offset or diminc. */ | /* dummy dim - offset or diminc. */ | |||
$PDL(CHILD)->dims[ $COMP(odim[i]) ] = $COMP(end[i]) - $ COMP(start[i]) + 1; | $PDL(CHILD)->dims[ $COMP(odim[i]) ] = $COMP(end[i]) - $ COMP(start[i]) + 1; | |||
$PRIV( incs[ $COMP(odim[i]) ] ) = 0; | $PRIV(incs)[ $COMP(odim[i]) ] = 0; | |||
} else { | } else { | |||
/** This is not a dummy dim -- deal with a regular slice along it. **/ | /** This is not a dummy dim -- deal with a regular slice along it. **/ | |||
/** Get parent dim size for this idim, and/or allow perm issive slicing **/ | /** Get parent dim size for this idim, and/or allow perm issive slicing **/ | |||
PDL_Indx pdsize = $COMP(idim[i]) < $PDL(PARENT)->ndims ? | PDL_Indx pdsize = $COMP(idim[i]) < $PDL(PARENT)->ndims ? | |||
$PDL(PARENT)->dims[$COMP(idim)[i]] : 1; | $PDL(PARENT)->dims[$COMP(idim)[i]] : 1; | |||
PDL_Indx start = $COMP(start)[i]; | PDL_Indx start = $COMP(start)[i]; | |||
PDL_Indx end = $COMP(end)[i]; | PDL_Indx end = $COMP(end)[i]; | |||
if( | if( | |||
/** Trap special case: full slices of an empty dim are empty **/ | /** Trap special case: full slices of an empty dim are empty **/ | |||
(pdsize==0 && start==0 && end==-1 && $COMP(inc[i]) == 0) | (pdsize==0 && start==0 && end==-1 && $COMP(inc[i]) == 0) | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added |