Low level routine
fr - eng


comp_c - sign comparison computational routine

Module

Parameters

File content


/* comp_c subroutine
 * sign comparison computation
 *
 * Copyright (C) 2007-2011 Alan Layec
 *
 * This file is part of modnumlib.
 *
 * modnumlib is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * modnumlib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with modnumlib; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

/* REVISION HISTORY :
 * $Log$
 */

#include "modnum_lib.h"

/* comp_c routine de calcul de comparaison de signe
 * Entrées :
 * n    : taille des vecteurs
 * amp  : amplitude des sorties (scalaire)
 * u    : vecteur d'entrée
 * Sorties :
 * y   : vecteur de sortie
 */

void comp_c(int *n,double *ampl,double *u,double *y)
{
 int i;

 for(i=0;i<(*n);i++)
 {
  if(u[i]>0) y[i]=(*ampl);
  else y[i]=-(*ampl);
 }
 return;
}

/*
 * compv_c routine de calcul de comparaison de signe
 *
 * Entrées :
 * n    : taille des vecteurs
 * amp  : amplitude des sorties (vecteur)
 * u    : vecteur d'entrée
 * Sorties :
 * y   : vecteur de sortie
 */
void compv_c(int *n,double *ampl,double *u,double *y)
{
 int i;

 for(i=0;i<(*n);i++)
 {
  if(u[i]>=0) y[i]=ampl[i];
  else y[i]=-ampl[i];
 }
 return;
}

Authors

A. Layec