343 |
|
if (!split_input(rop)) /* get our own struct */ |
344 |
|
return(0); |
345 |
|
rop->rmp->ncomp = rop->preop.clen / rop->imx.ncomp; |
346 |
< |
if ((rop->rmp->ncomp > 3) & (rop->rmp->dtype <= DTspec)) |
346 |
> |
if ((rop->rmp->ncomp > 3) & (rop->rmp->dtype <= DTspec)) { |
347 |
|
rop->rmp->dtype = DTfloat; /* probably not actual spectrum */ |
348 |
+ |
memcpy(rop->rmp->wlpart, WLPART, sizeof(rop->rmp->wlpart)); |
349 |
+ |
} |
350 |
|
} else if (rop->preop.nsf > 0) { /* else use scalar(s)? */ |
351 |
|
if (rop->preop.nsf == 1) { |
352 |
|
for (i = rop->rmp->ncomp; --i; ) |
364 |
|
static int |
365 |
|
apply_op(RMATRIX *dst, const RMATRIX *src, const RUNARYOP *ro) |
366 |
|
{ |
365 |
– |
/* |
366 |
– |
if (!dst | !src | !ro || (dst->nrows != src->nrows) | |
367 |
– |
(dst->ncols != src->ncols)) |
368 |
– |
return(0); |
369 |
– |
*/ |
367 |
|
if (ro->clen > 0) { |
368 |
|
RMATRIX *res = rmx_transform(src, dst->ncomp, ro->cmat); |
369 |
|
if (!res) { |
370 |
|
fputs("Error in call to rmx_transform()\n", stderr); |
371 |
|
return(0); |
372 |
|
} |
373 |
< |
if (dst->mtx) free(dst->mtx); |
374 |
< |
dst->mtx = res->mtx; res->mtx = NULL; |
373 |
> |
if (!rmx_transfer_data(dst, res, 0)) |
374 |
> |
return(0); |
375 |
|
rmx_free(res); |
376 |
|
} else if (dst != src) |
377 |
|
memcpy(dst->mtx, src->mtx, |
549 |
|
goto memerror; |
550 |
|
} |
551 |
|
if (mcat && mcat_last && |
552 |
< |
!(tmp = rmx_new(1, res->imx.ncols, res->rmp->ncomp))) |
552 |
> |
!(tmp = rmx_alloc(1, res->imx.ncols, res->rmp->ncomp))) |
553 |
|
goto memerror; |
554 |
|
res->imx.nrows = 1; |
555 |
|
if (!rmx_prepare(&res->imx)) |
606 |
|
mres = rmx_multiply(tmp, mcat); |
607 |
|
if (!mres) |
608 |
|
goto multerror; |
609 |
< |
if (res->rmp->mtx) free(res->rmp->mtx); |
610 |
< |
res->rmp->mtx = mres->mtx; mres->mtx = NULL; |
609 |
> |
if (!rmx_transfer_data(res->rmp, mres, 0)) |
610 |
> |
return(0); |
611 |
|
} else /* mcat && !mcat_last */ { |
612 |
|
mres = rmx_multiply(&res->imx, mcat); |
613 |
|
if (!mres) |
794 |
|
mop[nmats].inspec = "trailing_ops"; |
795 |
|
/* load final concatenation matrix */ |
796 |
|
if (mcat_spec && !(mcat = rmx_load(mcat_spec, RMPnone))) { |
797 |
< |
fprintf(stderr, "%s: error loading concatenation matrix: %s", |
797 |
> |
fprintf(stderr, "%s: error loading concatenation matrix: %s\n", |
798 |
|
argv[0], mcat_spec); |
799 |
|
return(1); |
800 |
|
} |
832 |
|
argv[0], mcat_spec); |
833 |
|
return(1); |
834 |
|
} |
835 |
+ |
if (!split_input(&mop[nmats])) |
836 |
+ |
return(1); |
837 |
|
mop[nmats].rmp->ncols = mcat->ncols; |
838 |
|
} |
839 |
|
newheader("RADIANCE", stdout); /* write output header */ |