/* MFMCA8.f -- translated by f2c (version 19960827).
   You must link the resulting object file with the libraries:
	-lf2c -lm   (in that order)
*/

#include "Data_f2c.h"
#ifdef WNT
#include <MathBase.h>
#else 
#define  __MathBase_API
#endif
/* Subroutine */ __MathBase_API int mmfmca8_(ndimen, ncoefu, ncoefv, ndimax, ncfumx, ncfvmx, 
	tabini, tabres)
integer *ndimen, *ncoefu, *ncoefv, *ndimax, *ncfumx, *ncfvmx;
doublereal *tabini, *tabres;
{
    /* System generated locals */
    integer tabini_dim1, tabini_dim2, tabini_offset, tabres_dim1, tabres_dim2,
	     tabres_offset;

    /* Local variables */
    static integer i__, j, k, ilong;
    extern /* Subroutine */ int mcrfill_();



/* < */
/* **NOTICE */
/*  THIS SOFTWARE IS THE PROPERTY OF CISIGRAPH. */
/*  THIS CODE MUST NOT BE DISTRIBUTED OR COPIED WITHOUT THE PRIOR */
/*  WRITTEN PERMISSION OF CISIGRAPH AND IS ONLY TO BE USED ON THE */
/*  SITE WHERE IT IS INSTALLED BY CISIGRAPH */
/* **NOTICE */

/* ********************************************************************** 
*/

/*     FONCTION : */
/*     ---------- */
/*        Expansion d' un tableau ne contenant que l' essentiel */
/*        en un tableau de donnees plus grand. */

/*     MOTS CLES : */
/*     ----------- */
/*     TOUS, MATH_ACCES:: CARREAU&, DECOMPRESSION, &CARREAU */

/*     ARGUMENTS D'ENTREE : */
/*     ------------------ */
/*        NDIMEN: Dimension de l' espace de travail. */
/*        NCOEFU: Le degre +1 du tableau en u. */
/*        NCOEFV: Le degre +1 du tableau en v. */
/*        NDIMAX: Dimension maxi de l' espace. */
/*        NCFUMX: Degre maximal +1 du tableau en u. */
/*        NCFVMX: Degre maximal +1 du tableau en v. */
/*        TABINI: Le tableau a decompacter. */

/*     ARGUMENTS DE SORTIE : */
/*     ------------------- */
/*        TABRES: Le tableau decompacte. */

/*     COMMONS UTILISES   : */
/*     ---------------- */

/*     REFERENCES APPELEES   : */
/*     ----------------------- */

/*     DESCRIPTION/REMARQUES/LIMITATIONS : */
/*     ----------------------------------- */
/*     L' appel suivant : */

/*  CALL MMFMCA8(NDIMEN,NCOEFU,NCOEFV,NDIMAX,NCFUMX,NCFVMX,TABINI,TABINI) 
*/

/*     ou TABINI est un argument d' entree/sortie, est possible pourvu */
/*     que l' appelant ait declare TABINI en (NDIMAX,NCFUMX,NCFVMX) */

/*     ATTENTION : on ne verifie pas que NDIMAX >= NDIMEN, */
/*                 NCOEFU >= NCFMXU et NCOEFV >= NCFMXV. */

/* $    HISTORIQUE DES MODIFICATIONS   : */
/*     -------------------------------- */
/*     03-08-1989 : RBD; Creation */
/* > */
/* ********************************************************************** 
*/


    /* Parameter adjustments */
    tabini_dim1 = *ndimen;
    tabini_dim2 = *ncoefu;
    tabini_offset = tabini_dim1 * (tabini_dim2 + 1) + 1;
    tabini -= tabini_offset;
    tabres_dim1 = *ndimax;
    tabres_dim2 = *ncfumx;
    tabres_offset = tabres_dim1 * (tabres_dim2 + 1) + 1;
    tabres -= tabres_offset;

    /* Function Body */
    if (*ndimax == *ndimen) {
	goto L1000;
    }

/* ----------------------- decompression NDIMAX<>NDIMEN ----------------- 
*/

    for (k = *ncoefv; k >= 1; --k) {
	for (j = *ncoefu; j >= 1; --j) {
	    for (i__ = *ndimen; i__ >= 1; --i__) {
		tabres[i__ + (j + k * tabres_dim2) * tabres_dim1] = tabini[
			i__ + (j + k * tabini_dim2) * tabini_dim1];
/* L300: */
	    }
/* L200: */
	}
/* L100: */
    }
    goto L9999;

/* ----------------------- decompression NDIMAX=NDIMEN ------------------ 
*/

L1000:
    if (*ncoefu == *ncfumx) {
	goto L2000;
    }
    ilong = (*ndimen << 3) * *ncoefu;
    for (k = *ncoefv; k >= 1; --k) {
	mcrfill_(&ilong, &tabini[(k * tabini_dim2 + 1) * tabini_dim1 + 1], &
		tabres[(k * tabres_dim2 + 1) * tabres_dim1 + 1]);
/* L500: */
    }
    goto L9999;

/* ----------------- decompression NDIMAX=NDIMEN,NCOEFU=NCFUMX ---------- 
*/

L2000:
    ilong = (*ndimen << 3) * *ncoefu * *ncoefv;
    mcrfill_(&ilong, &tabini[tabini_offset], &tabres[tabres_offset]);
    goto L9999;

/* ---------------------------- The end --------------------------------- 
*/

L9999:
    return 0;
} /* mmfmca8_ */

