summation.c

Go to the documentation of this file.
00001 #include "scicos_block.h"
00002 #include <math.h>
00003 
00004 void summation(scicos_block *block,int flag)
00005 {
00006   int j,k;
00007   if(flag==1){
00008     if (block->nin==1){
00009       block->outptr[0][0]=0.0;
00010       for (j=0;j<block->insz[0];j++) {
00011         block->outptr[0][0]=block->outptr[0][0]+block->inptr[0][j];
00012       }
00013     }
00014     else {
00015       for (j=0;j<block->insz[0];j++) {
00016         block->outptr[0][j]=0.0;
00017         for (k=0;k<block->nin;k++) {
00018           if(block->ipar[k]>0){
00019             block->outptr[0][j]=block->outptr[0][j]+block->inptr[k][j];
00020           }else{
00021             block->outptr[0][j]=block->outptr[0][j]-block->inptr[k][j];
00022           }
00023         }
00024       }
00025     }
00026   }
00027 }

Generated on Sun Mar 4 15:04:00 2007 for Scilab [trunk] by  doxygen 1.5.1