%% $RCSfile: sdspdiff.tlc,v $ %% $Revision: 1.10 $ %% $Date: 2000/06/15 20:37:40 $ %% %% Copyright 1995-2000 The MathWorks, Inc. %% %% Abstract: Element-to-element difference along a vector %implements sdspdiff "C" %% Function: Outputs ========================================================== %% %function Outputs(block, system) Output /* DSP Blockset Difference (%) - % */ %% %assign INPORT = 0 %assign OUTPORT = 0 %assign c0 = LibBlockOutputSignalIsComplex(OUTPORT) %assign inplace = (LibBlockInputSignalBufferDstPort(INPORT) == OUTPORT) %assign contig = IsInputPortContiguous(block,INPORT) %assign N = LibDataInputPortWidth(INPORT) %% %if inplace /* In-place algorithm */ %if !c0 %% REAL { real_T *y1 = %; real_T *y = y1-1; int N = %; while(--N > 0) { *y1-- -= *y--; } } %else %% COMPLEX { creal_T *y1 = %; creal_T *y = y1-1; int N = %; while(--N > 0) { y1->re -= y->re; (y1--)->im -= (y--)->im; } } %endif %% %elseif contig %% %% Contiguous %if !c0 %% REAL { real_T *u1 = %; real_T *u = u1-1; real_T *y = %; int N = %; while(--N > 0) { *y-- = *u1-- - *u--; } } %else %% COMPLEX { creal_T *u1 = %; creal_T *u = u1-1; creal_T *y = %; int N = %; while(--N > 0) { y->re = u1->re - u->re; (y--)->im = (u1--)->im - (u--)->im; } } %endif %% %else % %endif %endfunction %% [EOF] sdspdiff.tlc