"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Basic/Core/pdlbroadcast.c" between
PDL-2.075.tar.gz and PDL-2.076.tar.gz

About: PDL (Perl Data Language) aims to turn perl into an efficient numerical language for scientific computing (similar to IDL and MatLab).

pdlbroadcast.c  (PDL-2.075):pdlbroadcast.c  (PDL-2.076)
skipping to change at line 234 skipping to change at line 234
pdl_transvtable *vtable, pdl **pdls, pdl_transvtable *vtable, pdl **pdls,
pdl_broadcast *broadcast, PDL_Indx *creating, pdl_broadcast *broadcast, PDL_Indx *creating,
PDL_Indx *ind_sizes, char load_only PDL_Indx *ind_sizes, char load_only
) { ) {
pdl_error PDL_err = {0, NULL, 0}; pdl_error PDL_err = {0, NULL, 0};
PDL_Indx i, j, ind_id; PDL_Indx i, j, ind_id;
PDLDEBUG_f(printf("pdl_dim_checks(%d) %p:\n", load_only, ind_sizes); PDLDEBUG_f(printf("pdl_dim_checks(%d) %p:\n", load_only, ind_sizes);
printf(" ind_sizes: "); pdl_print_iarr(ind_sizes, vtable->ninds);printf("\n ")); printf(" ind_sizes: "); pdl_print_iarr(ind_sizes, vtable->ninds);printf("\n "));
for (i=0; i<vtable->npdls; i++) { for (i=0; i<vtable->npdls; i++) {
PDL_Indx ninds = vtable->par_realdims[i]; PDL_Indx ninds = vtable->par_realdims[i];
PDLDEBUG_f(printf("pdl_dim_checks pdl %"IND_FLAG" (creating=%"IND_FLAG" nind s=%"IND_FLAG"): ", i, creating[i], ninds)); PDLDEBUG_f(printf("pdl_dim_checks pdl %"IND_FLAG" (creating=%"IND_FLAG" nind s=%"IND_FLAG"): ", i, creating ? creating[i] : -99, ninds));
pdl *pdl = pdls[i]; pdl *pdl = pdls[i];
PDL_Indx ndims = pdl->ndims; PDL_Indx ndims = pdl->ndims;
PDLDEBUG_f(pdl_dump(pdl)); PDLDEBUG_f(pdl_dump(pdl));
if (!load_only && creating[i]) { if (!load_only && creating[i]) {
PDL_Indx dims[PDLMAX(ninds+1, 1)]; PDL_Indx dims[PDLMAX(ninds+1, 1)];
for (j=0; j<ninds; j++) for (j=0; j<ninds; j++)
dims[j] = ind_sizes[PDL_IND_ID(vtable, i, j)]; dims[j] = ind_sizes[PDL_IND_ID(vtable, i, j)];
if (vtable->par_flags[i] & PDL_PARAM_ISTEMP) if (vtable->par_flags[i] & PDL_PARAM_ISTEMP)
dims[ninds] = 1; dims[ninds] = 1;
PDL_RETERROR(PDL_err, pdl_broadcast_create_parameter( PDL_RETERROR(PDL_err, pdl_broadcast_create_parameter(
broadcast,i,dims, broadcast,i,dims,
vtable->par_flags[i] & PDL_PARAM_ISTEMP vtable->par_flags[i] & PDL_PARAM_ISTEMP
)); ));
} else { } else {
PDL_Indx *dims = pdl->dims; PDL_Indx *dims = pdl->dims;
if ((load_only || !creating[i]) && ninds > PDLMAX(0,ndims)) { if ((load_only || (creating && !creating[i])) && ninds > PDLMAX(0,ndims)) {
/* Dimensional promotion when number of dims is less than required: */ /* Dimensional promotion when number of dims is less than required: */
for (j=0; j<ninds; j++) { for (j=0; j<ninds; j++) {
ind_id = PDL_IND_ID(vtable, i, j); ind_id = PDL_IND_ID(vtable, i, j);
if (ndims < j+1 && ind_sizes[ind_id] <= 1) ind_sizes[ind_id] = 1; if (ndims < j+1 && ind_sizes[ind_id] <= 1) ind_sizes[ind_id] = 1;
} }
} }
/* Now, the real check. */ /* Now, the real check. */
for (j=0; j<ninds; j++) { for (j=0; j<ninds; j++) {
ind_id = PDL_IND_ID(vtable, i, j); ind_id = PDL_IND_ID(vtable, i, j);
if (load_only || !creating[i]) { if (
(load_only && !((vtable->par_flags[i] & PDL_PARAM_ISCREAT) && (pdl->sta
te & PDL_MYDIMS_TRANS))) ||
(creating && !creating[i])
) {
if (ind_sizes[ind_id] == -1 || (ndims > j && ind_sizes[ind_id] == 1)) if (ind_sizes[ind_id] == -1 || (ndims > j && ind_sizes[ind_id] == 1))
ind_sizes[ind_id] = dims[j]; ind_sizes[ind_id] = dims[j];
else if (ndims > j && ind_sizes[ind_id] != dims[j] && dims[j] != 1) else if (ndims > j && ind_sizes[ind_id] != dims[j] && dims[j] != 1)
return pdl_make_error(PDL_EUSERERROR, return pdl_make_error(PDL_EUSERERROR,
"Error in %s: parameter '%s' index %s size %"IND_FLAG", but ndarray dim has size %"IND_FLAG"\n", "Error in %s: parameter '%s' index %s size %"IND_FLAG", but ndarray dim has size %"IND_FLAG"\n",
vtable->name, vtable->par_names[i], vtable->ind_names[ind_id], vtable->name, vtable->par_names[i], vtable->ind_names[ind_id],
ind_sizes[ind_id], dims[j] ind_sizes[ind_id], dims[j]
); );
} }
} }
 End of changes. 3 change blocks. 
3 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)