invblk4.c

Go to the documentation of this file.
00001 #include "scicos_block.h"
00002 #include <stdio.h>
00003 
00004 void invblk4(scicos_block *block,int flag)
00005 {
00006   /* Copyright INRIA
00007      
00008   Scicos block simulator
00009   Outputs the inverse of the input */
00010   
00011   int i;
00012   double ww;
00013   if (flag == 6){
00014     for(i=0;i< block->insz[0];i++){
00015       ww=block->inptr[0][i];
00016       if (ww != 0.0)
00017         block->outptr[0][i]=1.0/ww;
00018     }
00019   }
00020   if (flag == 1){
00021     for(i=0;i< block->insz[0];i++){
00022       ww=block->inptr[0][i];
00023       if (ww != 0.0)
00024         block->outptr[0][i]=1.0/ww;
00025       else{
00026         flag=-2;
00027         /*printf("\n\r Error, singularity has been detected");*/        
00028         return;
00029       }
00030     }
00031   } 
00032 }

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