Routine bas-niveau
fr - eng


sousecht_c - routine de calcul réducteur de cadence

Module

Paramètres

Contenu du fichier


/* sousecht_c subroutine
 * Down-Sampling 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"

/* sousecht_c routine de calcul de sous-échantillonnage en temporel
 *
 * Entrées :
 * n     : dimension 1 de la matrice d'entrée (scalaire)
 * m     : dimension 2 de la matrice d'entrée (scalaire)
 * nech   : facteur de sous-échantillonnage
 * init_c : valeur initiale du compteur (doit être entre 0 et nech-1)
 * u      : matrice d'entrée à sous-échantillonner de taille n,m
 *
 * Sorties :
 * y      : matrice de sortie de taille int(n/nech),m
 *
 * Entrée/Sortie :
 * init_c : valeur initiale du compteur (vecteur de taille m)
 *
 */

void sousecht_c(int *n,int *m,int *nech,int *init_c,double *u,double *y)
{
 /*Déclaration des variables compteurs*/
 int i,j,l;
 int count;

 for(l=0;l<(*m);l++) {
   /*Récupère valeur initiale du compteur*/
   count=init_c[l];
   /*raz j*/
   j=0;
   /*Pour tous les échantillons des vecteurs d'entrée*/
   for(i=0;i<(*n);i++) {
     /*if(i==(count-1))*/
     if(i==(count-1)) {
       y[l*((*n)/(*nech))+j]=u[l*(*n)+i];
       count += (*nech);
       j++;
     }
   }
   init_c[l]=Abs(count-(*n));
 }
 return;
}

void sousechti_c(int *n,int *m,int *nech,int *init_c,int *u,int *y)
{
 /*Déclaration des variables compteurs*/
 int i,j,l;
 int count;

 for(l=0;l<(*m);l++) {
   /*Récupère valeur initiale du compteur*/
   count=init_c[l];
   /*raz j*/
   j=0;
   /*Pour tous les échantillons des vecteurs d'entrée*/
   for(i=0;i<(*n);i++) {
     /*if(i==(count-1))*/
     if(i==(count-1)) {
       y[l*((*n)/(*nech))+j]=u[l*(*n)+i];
       count += (*nech);
       j++;
     }
   }
   init_c[l]=Abs(count-(*n));
 }
 return;
}

void sousechty_c(int *n,int *m,int *nech,int *init_c,double *u,double *y)
{
 /*Déclaration des variables compteurs*/
 int i,j,l;
 int count;

 for(l=0;l<(*m);l++) {
   /*Récupère valeur initiale du compteur*/
   count=init_c[l];
   /*raz j*/
   j=0;
   /*Pour tous les échantillons des vecteurs d'entrée*/
   for(i=0;i<(*n);i++) {
     /*if(i==(count-1))*/
     if(i==(count-1)) {
       y[l*((*n)/(*nech))+j]=u[l*(*n)+i];
       count += (*nech);
       j++;
     }
   }
 }
 return;
}

Auteurs

A. Layec