Logo Search packages:      
Sourcecode: r-cran-vgam version File versions  Download package

vgam3.c






#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<R.h>
#include<Rmath.h>

void Yee_vbvs(int *f8yswcat, double gkdx5jal[], double rpyis2kc[],
              double sjwyig9t[], double kispwgx3[],
              int *acpios9q, int *order, int *wy1vqfzu);
void fapc0tnbtfeswo7c(double osiz4fxy[], int *acpios9q, int *wy1vqfzu, int *ldk,
                   double wbkq9zyi[],
                   double xecbg0pf[], double z4grbpiq[], double d7glzhbj[], double v2eydbxs[]);
void fapc0tnbybnagt8k(int *iii, int *cz8qdfyj, int *tesdm5kv,
                    double g9fvdrbw[], double osiz4fxy[], double rbne6ouj[],
                    int *kxvq6sfw, int *nyfu9rod, int *wy1vqfzu, int *ldk,
                    int *kvowz9ht, int *kuzxj1lo,
                    int tgiyxdw1[], int dufozmt7[]);
void Yee_spline(double *sjwyig9t, double *tlgduey8, double *rbne6ouj, double *gkdx5jal,
                   int *lqsahu0r, int *acpios9q, int *ldk, int *wy1vqfzu, int *kvowz9ht,
                   double wbkq9zyi[], double lamvec[],
                   int *aalgpft4y, double t8hwvalr[],
                   double rpyis2kc[], double ui8ysltq[],
                   double ifys6woa[], double hdnw2fts[],
                   int *yzoe1rsp, int *fbd5yktj, int *ftnjamu2,
                   double xecbg0pf[], double z4grbpiq[], double d7glzhbj[], double v2eydbxs[],
                   double tt2[], int *cvnjhg2u,
                   int    itdcb8ilk[],  // Added 20100313
                   double  tdcb8ilk[]   // Added 20100313
                   );
void fapc0tnbcn8kzpab(double gkdx5jal[], double sjwyig9t[], double rpyis2kc[],
                   int *lqsahu0r, int *acpios9q, int *wy1vqfzu, double t8hwvalr[]);
void vsuff9(int *ftnjamu2, int *lqsahu0r, int ezlgm2up[],
                   double sjwyig9t[], double tlgduey8[], double rbne6ouj[],
                   double pygsw6ko[], double pasjmo8g[], double eshvo2ic[],
                   double ueshvo2ic[], double onxjvw8u[], int *dvhw1ulq,
                   int *wy1vqfzu, int *kvowz9ht, int *npjlv3mr,
                   double conmat[], int *kgwmz4ip,
                   int *iz2nbfjc, int *wueshvo2ic,
                   int *npjlv3mreshvo2ic, int *dim2eshvo2ic);
void fapc0tnbicpd0omv(double enaqpzk9[], double sjwyig9t[], double gkdx5jal[],
                    double grmuyvx9[],
                    int *ldk, int *lqsahu0r, int *acpios9q, int *wy1vqfzu, int *jzwsy6tp,
                    double rbne6ouj[], double ifys6woa[],
                    int *kvowz9ht, int *ftnjamu2);
void fapc0tnbo0xlszqr(int *wy1vqfzu, double *g9fvdrbw, double *quc6khaf, double *bmb);
void fapc0tnbvsel(int *nurohxe6t, int *nbpvaqm5z, int *wy1vqfzu, int *ldk,
                 double minv[], double quc6khaf[]);
void fapc0tnbovjnsmt2(double bmb[], double rbne6ouj[],
                    double ifys6woa[],
                    int *wy1vqfzu, int *kuzxj1lo, int *dimw, int *iii,
                    int tgiyxdw1_[], int dufozmt7_[]);
void fapc0tnbvicb2(double enaqpzk9[], double wpuarq2m[], double Dvector[],
                  int *wy1vqfzu, int *f8yswcat);

void fapc0tnbewg7qruh(double ci1oyxas[], double tlgduey8[], double rbne6ouj[],
         int *ftnjamu2, int *wy1vqfzu, int ezlgm2up[], int *lqsahu0r,
         double wbkq9zyi[], double lamvec[], double hdnw2fts[],
         double kispwgx3[], double ui8ysltq[],
         int *kvowz9ht, int *fbd5yktj, int *ldk, int *aalgpft4y, int *yzoe1rsp,
         double rpyis2kc[], double gkdx5jals[], double ifys6woa[], double conmat[],

         double xecbg0pf[], double z4grbpiq[], double d7glzhbj[], double v2eydbxs[],
         double *tt2,  int *cvnjhg2u,

         int *acpios9q, int *iz2nbfjc, int *kgwmz4ip,
         int *npjlv3mr,
         int    itdcb8ilk[],  // Added 20100313
         double  tdcb8ilk[]   // Added 20100313
                   );
void Yee_vbfa(
       int psdvgce3[], double *doubvec, double he7mqnvy[], double tlgduey8[],
       double rbne6ouj[], double hdnw2fts[], double lamvec[], double wbkq9zyi[],
       int ezlgm2up[], int lqsahu0r[], int which[],
       double kispwgx3[], double m0ibglfx[],
       double zshtfg8c[], double ui8ysltq[],
       double vc6hatuj[], double fasrkub3[], int ges1xpkr[],


       double wpuarq2m[], double hjm2ktyr[], int ulm3dvzg[],
       int hnpt1zym[],
       int iz2nbfjc[],


       double ifys6woa[],


       double rpyis2kc[], double gkdx5jals[],
       int nbzjkpi3[], int acpios9q[], int jwbkl9fp[]);
void fapc0tnbvbfa1(int *ftnjamu2, int *wy1vqfzu, int ezlgm2up[], int lqsahu0r[], int which[],
            double he7mqnvy[], double tlgduey8[], double rbne6ouj[],
            double wbkq9zyi[], double lamvec[], double hdnw2fts[],
            double kispwgx3[], double m0ibglfx[], double zshtfg8c[],
            double ui8ysltq[], double *zpcqv3uj, double vc6hatuj[], double fasrkub3[],
            int *qemj9asg, int ges1xpkr[], double wpuarq2m[], double hjm2ktyr[],
            int ulm3dvzg[], int hnpt1zym[], int iz2nbfjc[],
            double ifys6woa[],
            double rpyis2kc[], double gkdx5jals[], double *ghdetj8v,
            int nbzjkpi3[], int acpios9q[], int jwbkl9fp[],
            int *nhja0izq, int *yzoe1rsp, int *ueb8hndv, int *gtrlbz3e,
            int *rutyk8mg, int *xjc4ywlh,
            int *kvowz9ht, int *npjlv3mr, int *fbd5yktj, int *ldk, int *algpft4y,
            int     itdcb8ilk[],
            double   tdcb8ilk[]);
void fapc0tnbx6kanjdh(double sjwyig9t[], double xout[], int *f8yswcat, int *wy1vqfzu);
double fapc0tnbrd9beyfk(int *f8yswcat, double bhcji9gl[], double po8rwsmy[],
                     double m0ibglfx[]);
void fapc0tnbpitmeh0q(int *f8yswcat, double bhcji9gl[], double po8rwsmy[],
                    double *lfu2qhid, double *lm9vcjob);
void fapc0tnbdsrt0gem(int *f8yswcat, double sjwyig9t[], double po8rwsmy[], double bhcji9gl[],
                   double ub4xioar[], double ui8ysltq[], int *yzoe1rsp);
void fapc0tnbshm8ynte(int *ftnjamu2,
                   int ezlgm2up[], double pygsw6ko[], double sjwyig9t[]);
void vknootl2(double x[], int *f8yswcat, double gkdx5jal[], int *rvy1fpli,
              int *ukgwt7na);
void Yee_pknootl2(double *gkdx5jal, int *f8yswcat, int *zo8wpibx, double *Toler_ankcghz2);
void F77_NAME(wbvalue)(double*, double*, int*, int*, double*, int*,
                       double*);
void F77_NAME(vinterv)(double*, int*, double*, int*, int*);
void F77_NAME(vbsplvd)(double*, int*, double*, int*, double*, double*,int*);
void F77_NAME(vdpbfa7)(double*, int*, int*, int*, int*, double*);
void F77_NAME(vdpbsl7)(double*, int*, int*, int*, double*, double*);
void F77_NAME(vdqrsl)(double*, int*, int*, int*, double*, double*, double*,
                      double*, double*, double*, double*, int*, int*);
void F77_NAME(vqrdca)(double*, int*, int*, int*, double*, int*, double*,
                      int*, double*);

void Free_fapc0tnbvsplin(double *wkumc9idosiz4fxy,  double *wkumc9idenaqpzk9,
             double *wkumc9idbtwy,   double *wkumc9idwk0,    double *wkumc9idbk3ymcih,
             int    *wkumc9idtgiyxdw1, int    *wkumc9iddufozmt7);
void Free_fapc0tnbewg7qruh(double *wkumc9idWrk1,
                        int    *wkumc9idges1xpkr,
                        double *wkumc9idbeta,   double *wkumc9idfasrkub3,
                        double *wkumc9idsout,   double *wkumc9idr0oydcxb,
                        double *wkumc9idub4xioar,   double *wkumc9ideffect,
                        double *wkumc9idueshvo2ic, double *wkumc9ids0,
                        double *wkumc9idpygsw6ko,   double *wkumc9idpasjmo8g,
                        double *wkumc9ideshvo2ic,  double *wkumc9idonxjvw8u,
                        double *wkumc9idwk4);


extern
void n5aioudkdnaoqj0l(double *pjb6wfoq, double *xs, double *ys,
                    double ws[], int *kuzxj1lo, int *nk, double gkdx5jal[],
                    double coef[], double sz[], double ifys6woa[],
                    double *wbkq9zyi, double parms[],
                    double xecbg0pf[], double z4grbpiq[], double d7glzhbj[], double v2eydbxs[],
                    double *tt2,
                    int *cvnjhg2u, int l3zpbstu[],
                    int *xtov9rbf, int *wep0oibc, int *fbd5yktj);

extern
void n5aioudkzosq7hub(double xecbg0pf[], double z4grbpiq[], double d7glzhbj[], double v2eydbxs[],
                   double tb[], int *nb);

extern
void fvlmz9iyC_qpsedg8x(int tgiyxdw1[], int dufozmt7[], int *wy1vqfzu);

extern
void fvlmz9iyjdbomp0g(double rbne6ouj[], double unvxka0m[], int *wy1vqfzu, int *dvhw1ulq,
                  int *isolve);

extern
void fvlmz9iyjdbomp0g(double rbne6ouj[], double unvxka0m[], int *wy1vqfzu, int *dvhw1ulq,
                  int *isolve);

extern
void fvlmz9iyC_nudh6szq(double wpuarq2m[], double tlgduey8[], double lfu2qhid[],
        int *dimu, int *f8yswcat, int *wy1vqfzu);

extern
void fvlmz9iyC_vbks(double wpuarq2m[], double unvxka0m[], int *wy1vqfzu, int *f8yswcat,
                 int *dimu);

extern
void fvlmz9iyC_lkhnw9yq(double wpuarq2m[], double ks3wejcv[],
                   int *npjlv3mr, int *wy1vqfzu, int *dvhw1ulq);

extern
void fvlmz9iyC_mxrbkut0(double wpuarq2m[], double he7mqnvy[], int *wy1vqfzu, int *xjc4ywlh,
                  int *f8yswcat, int *dimu, int *rutyk8mg);




void Yee_vbvs(int *f8yswcat, double gkdx5jal[], double rpyis2kc[],
              double sjwyig9t[], double kispwgx3[],
              int *acpios9q, int *order, int *wy1vqfzu) {


  double *chw8lzty;
  int    ayfnwr1v, yq6lorbx, h2dpsbkr = 4;

  for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
      chw8lzty = sjwyig9t;
      for (ayfnwr1v = 1; ayfnwr1v <= *f8yswcat; ayfnwr1v++) {
          F77_CALL(wbvalue)(gkdx5jal, rpyis2kc, acpios9q, &h2dpsbkr,
                            chw8lzty++, order, kispwgx3++);
      }
      rpyis2kc += *acpios9q;
  }
}


void fapc0tnbtfeswo7c(double osiz4fxy[], int *acpios9q, int *wy1vqfzu, int *ldk,
                   double wbkq9zyi[],
                   double xecbg0pf[], double z4grbpiq[], double d7glzhbj[], double v2eydbxs[]) {


  int    ayfnwr1v, yq6lorbx;
  double *fpdlcqk9wbkq9zyi, *fpdlcqk9xecbg0pf, *fpdlcqk9z4grbpiq, *fpdlcqk9d7glzhbj, *fpdlcqk9v2eydbxs,
         *fpdlcqk9osiz4fxy;


  fpdlcqk9osiz4fxy  = osiz4fxy + *ldk - 1;
  fpdlcqk9xecbg0pf = xecbg0pf;
  for (ayfnwr1v = 1; ayfnwr1v <= *acpios9q; ayfnwr1v++) {
      fpdlcqk9wbkq9zyi = wbkq9zyi;
      for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
        *fpdlcqk9osiz4fxy += *fpdlcqk9wbkq9zyi++ * *fpdlcqk9xecbg0pf;
         fpdlcqk9osiz4fxy += *ldk;
      }
      fpdlcqk9xecbg0pf++;
  }

  fpdlcqk9osiz4fxy  = osiz4fxy + *wy1vqfzu * *ldk;
  fpdlcqk9osiz4fxy  = fpdlcqk9osiz4fxy + *ldk - *wy1vqfzu - 1;
  fpdlcqk9z4grbpiq = z4grbpiq;
  for (ayfnwr1v = 1; ayfnwr1v <= *acpios9q; ayfnwr1v++) {
      fpdlcqk9wbkq9zyi = wbkq9zyi;
      for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
        *fpdlcqk9osiz4fxy += *fpdlcqk9wbkq9zyi++ * *fpdlcqk9z4grbpiq;
         fpdlcqk9osiz4fxy += *ldk;
      }
      fpdlcqk9z4grbpiq++;
  }

  fpdlcqk9osiz4fxy  = osiz4fxy + *ldk + 2 * *wy1vqfzu * *ldk;
  fpdlcqk9osiz4fxy  = fpdlcqk9osiz4fxy - 2 * *wy1vqfzu - 1;
  fpdlcqk9d7glzhbj = d7glzhbj;
  for (ayfnwr1v = 1; ayfnwr1v <= *acpios9q; ayfnwr1v++) {
      fpdlcqk9wbkq9zyi = wbkq9zyi;
      for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
        *fpdlcqk9osiz4fxy += *fpdlcqk9wbkq9zyi++ * *fpdlcqk9d7glzhbj;
         fpdlcqk9osiz4fxy += *ldk;
      }
      fpdlcqk9d7glzhbj++;
  }

  fpdlcqk9osiz4fxy  = osiz4fxy + *ldk + 3 * *wy1vqfzu * *ldk;
  fpdlcqk9osiz4fxy  = fpdlcqk9osiz4fxy - 3 * *wy1vqfzu - 1;
  fpdlcqk9v2eydbxs = v2eydbxs;
  for (ayfnwr1v = 1; ayfnwr1v <= *acpios9q; ayfnwr1v++) {
      fpdlcqk9wbkq9zyi = wbkq9zyi;
      for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
        *fpdlcqk9osiz4fxy += *fpdlcqk9wbkq9zyi++ * *fpdlcqk9v2eydbxs;
         fpdlcqk9osiz4fxy += *ldk;
      }
      fpdlcqk9v2eydbxs++;
  }
}


void fapc0tnbybnagt8k(int *iii, int *cz8qdfyj, int *tesdm5kv,
                    double g9fvdrbw[], double osiz4fxy[], double rbne6ouj[],
                    int *kxvq6sfw, int *nyfu9rod, int *wy1vqfzu, int *ldk,
                    int *kvowz9ht, int *kuzxj1lo, int tgiyxdw1[], int dufozmt7[]) {


  double tmp_wrk;
  int    urohxe6t, nead, bcol, brow, biuvowq2, nbj8tdsk;



  bcol = *cz8qdfyj + *tesdm5kv;
  brow = *cz8qdfyj;
  for (urohxe6t = 1; urohxe6t <= *kvowz9ht; urohxe6t++) {
      tmp_wrk = rbne6ouj[*iii -1 + (urohxe6t-1) * *kuzxj1lo] *
                g9fvdrbw[*kxvq6sfw-1] * g9fvdrbw[*nyfu9rod-1];

      biuvowq2 = (brow-1) * *wy1vqfzu + tgiyxdw1[urohxe6t-1];
      nbj8tdsk = (bcol-1) * *wy1vqfzu + dufozmt7[urohxe6t-1];
      nead = nbj8tdsk - biuvowq2;
      osiz4fxy[*ldk - nead - 1 + (nbj8tdsk-1) * *ldk] += tmp_wrk;

      if (*tesdm5kv > 0 && dufozmt7[urohxe6t-1] != tgiyxdw1[urohxe6t-1]) {
          biuvowq2 = (brow-1) * *wy1vqfzu + dufozmt7[urohxe6t-1];
          nbj8tdsk = (bcol-1) * *wy1vqfzu + tgiyxdw1[urohxe6t-1];
          nead = nbj8tdsk - biuvowq2;
          osiz4fxy[*ldk - nead - 1 + (nbj8tdsk-1) * *ldk] += tmp_wrk;
      }
  }

}


void Free_fapc0tnbvsplin(double *wkumc9idosiz4fxy,  double *wkumc9idenaqpzk9,
             double *wkumc9idbtwy,   double *wkumc9idwk0,    double *wkumc9idbk3ymcih,
             int    *wkumc9idtgiyxdw1, int    *wkumc9iddufozmt7) {
  Free(wkumc9idosiz4fxy);       Free(wkumc9idenaqpzk9);
  Free(wkumc9idbtwy);        Free(wkumc9idwk0);       Free(wkumc9idbk3ymcih);
  Free(wkumc9idtgiyxdw1);      Free(wkumc9iddufozmt7);
}


void Yee_spline(double *sjwyig9t, double *tlgduey8, double *rbne6ouj, double *gkdx5jal,
        int *lqsahu0r, int *acpios9q, int *ldk, int *wy1vqfzu, int *kvowz9ht,
        double wbkq9zyi[], double lamvec[],
        int *aalgpft4y, double t8hwvalr[],
        double rpyis2kc[], double ui8ysltq[], double ifys6woa[], double hdnw2fts[],
        int *yzoe1rsp, int *fbd5yktj, int *ftnjamu2,

        double xecbg0pf[], double z4grbpiq[], double d7glzhbj[], double v2eydbxs[],
        double *tt2, int *cvnjhg2u,

        int    itdcb8ilk[],  // Added 20100313
        double  tdcb8ilk[]   // Added 20100313
        ) {

  int    ayfnwr1v, yq6lorbx, gp1jxzuh, urohxe6t, bpvaqm5z,
         dqlr5bse, pqzfxw4i, wep0oibc;


  int    junkicrit = -1,
          xtov9rbf = 4,
         l3zpbstu[3], pn9eowxc;
  double jstx4uwe[4], g9fvdrbw[4], qaltf0nz = 0.1e-9,
         ms0qypiw[16], *fpdlcqk9btwy;

  int    yu6izdrc = 0, pqneb2ra = 1, qhzja4ny = 2, bvsquk3z = 3, h2dpsbkr = 4;
  int    arm0lkbg1, arm0lkbg2;

  double *wkumc9idosiz4fxy, *wkumc9idenaqpzk9,
         *wkumc9idbtwy,  *wkumc9idwk0,   *wkumc9idbk3ymcih;

  int    *wkumc9idtgiyxdw1, *wkumc9iddufozmt7;
  int    imk5wjxg  = *wy1vqfzu * (*wy1vqfzu + 1) / 2;

  double kpftdm0jmynl7uaq = tdcb8ilk[0],
         kpftdm0jzustx4fw = tdcb8ilk[1],
         kpftdm0jtol   = tdcb8ilk[2],
         kpftdm0jeps   = tdcb8ilk[3];


  wkumc9idtgiyxdw1  = Calloc(imk5wjxg, int);
  wkumc9iddufozmt7  = Calloc(imk5wjxg, int);
  fvlmz9iyC_qpsedg8x(wkumc9idtgiyxdw1, wkumc9iddufozmt7, wy1vqfzu);

  wkumc9idosiz4fxy   = Calloc(*ldk * (*wy1vqfzu * *acpios9q), double);
  wkumc9idenaqpzk9   = Calloc(*ldk * (*acpios9q * *wy1vqfzu), double);
  wkumc9idbtwy    = Calloc(*wy1vqfzu *  *acpios9q        , double);
  wkumc9idbk3ymcih  = Calloc(        *acpios9q        , double);
  wkumc9idwk0     = Calloc(*acpios9q * *wy1vqfzu         , double);





  for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {


      if (wbkq9zyi[yq6lorbx-1] == 0.0) {
          pn9eowxc = 0;
      } else {
          pn9eowxc = 1;
      }


      if (*wy1vqfzu == 1 || *kvowz9ht == *wy1vqfzu || pn9eowxc == 0) { // ggg

          wep0oibc = 1;

          l3zpbstu[0] = junkicrit;
          l3zpbstu[1] = pn9eowxc;
          l3zpbstu[2] = itdcb8ilk[0];
          jstx4uwe[0] =  kpftdm0jmynl7uaq;  // Prior to 20100313: was waiez6nt;
          jstx4uwe[1] =  kpftdm0jzustx4fw;  // Prior to 20100313: was fp6nozvx;
          jstx4uwe[2] =  kpftdm0jtol;    // Prior to 20100313: was Toler_df;
          jstx4uwe[3] =  kpftdm0jeps;    // Introduced as an arg, 20100313


          if (*wy1vqfzu == 1 || *kvowz9ht == *wy1vqfzu) {  // hhh
              for (ayfnwr1v = 1; ayfnwr1v <= *lqsahu0r; ayfnwr1v++) {
                   tlgduey8[ayfnwr1v-1 + (yq6lorbx-1) * *lqsahu0r] /=
                  rbne6ouj[ayfnwr1v-1 + (yq6lorbx-1) * *lqsahu0r];
              }


              n5aioudkdnaoqj0l(hdnw2fts + yq6lorbx-1,
                                sjwyig9t, tlgduey8 + (yq6lorbx-1) * *lqsahu0r,
                                     rbne6ouj + (yq6lorbx-1) * *lqsahu0r,
                             lqsahu0r, acpios9q,
                             gkdx5jal,  rpyis2kc  + (yq6lorbx-1) * *acpios9q,
                                     t8hwvalr  + (yq6lorbx-1) * *lqsahu0r,
                                    ifys6woa  + (yq6lorbx-1) * *ftnjamu2,
                             wbkq9zyi +  yq6lorbx-1, jstx4uwe,
                             xecbg0pf, z4grbpiq, d7glzhbj, v2eydbxs,
                             tt2,
                             cvnjhg2u, l3zpbstu,
                             &xtov9rbf, &wep0oibc, fbd5yktj);
              lamvec[yq6lorbx-1] = jstx4uwe[0];

              if (*fbd5yktj) {
                Rprintf("Error in n5aioudkdnaoqj0l; inside Yee_spline\n");
                Free_fapc0tnbvsplin(wkumc9idosiz4fxy,  wkumc9idenaqpzk9,
                                   wkumc9idbtwy,   wkumc9idwk0,    wkumc9idbk3ymcih,
                                   wkumc9idtgiyxdw1, wkumc9iddufozmt7);
                return;
              }

              if (*yzoe1rsp) {
                  for (ayfnwr1v = 1; ayfnwr1v <= *lqsahu0r; ayfnwr1v++) {
                      gp1jxzuh = ayfnwr1v-1 + (yq6lorbx-1) * *ftnjamu2;
                      bpvaqm5z = ayfnwr1v-1 + (yq6lorbx-1) * *lqsahu0r;
                      ui8ysltq[gp1jxzuh] = ifys6woa[gp1jxzuh] / rbne6ouj[bpvaqm5z];
                  }
              }
          } else {  // hhh and uuu
              n5aioudkdnaoqj0l(hdnw2fts + yq6lorbx-1,
                             sjwyig9t, wkumc9idbk3ymcih, rbne6ouj + (yq6lorbx-1) * *lqsahu0r,
                             lqsahu0r, acpios9q,
                             gkdx5jal,   rpyis2kc + (yq6lorbx-1) * *acpios9q, 
                                      t8hwvalr + (yq6lorbx-1) * *lqsahu0r,
                                     ifys6woa + (yq6lorbx-1) * *ftnjamu2,
                             wbkq9zyi +  yq6lorbx-1, jstx4uwe,
                             xecbg0pf, z4grbpiq, d7glzhbj, v2eydbxs,
                             tt2,
                             cvnjhg2u, l3zpbstu,
                             &xtov9rbf, &wep0oibc, fbd5yktj);

              lamvec[yq6lorbx-1] = jstx4uwe[0];

              if (*fbd5yktj) {
                  Rprintf("Error in Rgam_dnaoqj0l; inside Yee_spline\n");
                  Free_fapc0tnbvsplin(wkumc9idosiz4fxy,  wkumc9idenaqpzk9,
                                     wkumc9idbtwy,   wkumc9idwk0,    wkumc9idbk3ymcih,
                                     wkumc9idtgiyxdw1, wkumc9iddufozmt7);
                  return;
              }
          } // uuu

          if (*fbd5yktj) {
              Rprintf("Error in n5aioudkdnaoqj0l: fbd5yktj = %3d.\n", *fbd5yktj);
              Rprintf("Called within Yee_spline.\n");
              Free_fapc0tnbvsplin(wkumc9idosiz4fxy,  wkumc9idenaqpzk9,
                                 wkumc9idbtwy,   wkumc9idwk0,    wkumc9idbk3ymcih,
                                 wkumc9idtgiyxdw1, wkumc9iddufozmt7);
              return;
          }
      } // ggg
  }

  if (*wy1vqfzu == 1 || *kvowz9ht == *wy1vqfzu) {
      Free_fapc0tnbvsplin(wkumc9idosiz4fxy,  wkumc9idenaqpzk9,
                         wkumc9idbtwy,   wkumc9idwk0,    wkumc9idbk3ymcih,
                         wkumc9idtgiyxdw1, wkumc9iddufozmt7);
      return;
  }






  for (ayfnwr1v = 1; ayfnwr1v <= *lqsahu0r; ayfnwr1v++) {
      arm0lkbg1 = *acpios9q + 1;
      F77_CALL(vinterv)(gkdx5jal, &arm0lkbg1, sjwyig9t + ayfnwr1v-1,
                        &dqlr5bse, &pqzfxw4i);

      if (pqzfxw4i == 1) {
          if (sjwyig9t[ayfnwr1v-1] <= (gkdx5jal[dqlr5bse-1] + qaltf0nz)) {
              dqlr5bse--;
          } else {
              Rprintf("Freeing memory in Yee_spline and returning.\n");
              Free_fapc0tnbvsplin(wkumc9idosiz4fxy,  wkumc9idenaqpzk9,
                                 wkumc9idbtwy,   wkumc9idwk0,    wkumc9idbk3ymcih,
                                 wkumc9idtgiyxdw1, wkumc9iddufozmt7);
              return;
          }
      }

      F77_CALL(vbsplvd)(gkdx5jal, &h2dpsbkr, sjwyig9t + ayfnwr1v-1, &dqlr5bse, ms0qypiw,
                        g9fvdrbw, &pqneb2ra);

      yq6lorbx= dqlr5bse - 4 + 1;
      fpdlcqk9btwy = wkumc9idbtwy + (yq6lorbx-1) * *wy1vqfzu;
      for (urohxe6t = 1; urohxe6t <= *wy1vqfzu; urohxe6t++) {
          *fpdlcqk9btwy += tlgduey8[ayfnwr1v-1 + (urohxe6t-1) * *lqsahu0r] * g9fvdrbw[0];
          fpdlcqk9btwy++;
      }

      fapc0tnbybnagt8k(&ayfnwr1v, &yq6lorbx, &yu6izdrc,
                     g9fvdrbw, wkumc9idosiz4fxy, rbne6ouj,
                     &pqneb2ra, &pqneb2ra, wy1vqfzu, ldk,
                     kvowz9ht, lqsahu0r, wkumc9idtgiyxdw1, wkumc9iddufozmt7);
      fapc0tnbybnagt8k(&ayfnwr1v, &yq6lorbx, &pqneb2ra,
                     g9fvdrbw, wkumc9idosiz4fxy, rbne6ouj,
                     &pqneb2ra, &qhzja4ny, wy1vqfzu, ldk,
                     kvowz9ht, lqsahu0r, wkumc9idtgiyxdw1, wkumc9iddufozmt7);
      fapc0tnbybnagt8k(&ayfnwr1v, &yq6lorbx, &qhzja4ny,
                     g9fvdrbw, wkumc9idosiz4fxy, rbne6ouj,
                     &pqneb2ra, &bvsquk3z, wy1vqfzu, ldk,
                     kvowz9ht, lqsahu0r, wkumc9idtgiyxdw1, wkumc9iddufozmt7);
      fapc0tnbybnagt8k(&ayfnwr1v, &yq6lorbx, &bvsquk3z,
                     g9fvdrbw, wkumc9idosiz4fxy, rbne6ouj,
                     &pqneb2ra, &h2dpsbkr, wy1vqfzu, ldk,
                     kvowz9ht, lqsahu0r, wkumc9idtgiyxdw1, wkumc9iddufozmt7);

      yq6lorbx = dqlr5bse - 4 + 2;
      fpdlcqk9btwy = wkumc9idbtwy + (yq6lorbx-1) * *wy1vqfzu;
      for (urohxe6t = 1; urohxe6t <= *wy1vqfzu; urohxe6t++) {
          *fpdlcqk9btwy += tlgduey8[ayfnwr1v-1 + (urohxe6t-1) * *lqsahu0r] * g9fvdrbw[1];
          fpdlcqk9btwy++;
      }

      fapc0tnbybnagt8k(&ayfnwr1v, &yq6lorbx, &yu6izdrc,
                     g9fvdrbw, wkumc9idosiz4fxy, rbne6ouj,
                     &qhzja4ny, &qhzja4ny, wy1vqfzu, ldk,
                     kvowz9ht, lqsahu0r, wkumc9idtgiyxdw1, wkumc9iddufozmt7);
      fapc0tnbybnagt8k(&ayfnwr1v, &yq6lorbx, &pqneb2ra,
                     g9fvdrbw, wkumc9idosiz4fxy, rbne6ouj,
                     &qhzja4ny, &bvsquk3z, wy1vqfzu, ldk,
                     kvowz9ht, lqsahu0r, wkumc9idtgiyxdw1, wkumc9iddufozmt7);
      fapc0tnbybnagt8k(&ayfnwr1v, &yq6lorbx, &qhzja4ny,
                     g9fvdrbw, wkumc9idosiz4fxy, rbne6ouj,
                     &qhzja4ny, &h2dpsbkr, wy1vqfzu, ldk,
                     kvowz9ht, lqsahu0r, wkumc9idtgiyxdw1, wkumc9iddufozmt7);

      yq6lorbx = dqlr5bse - 4 + 3;
      fpdlcqk9btwy = wkumc9idbtwy + (yq6lorbx-1) * *wy1vqfzu;
      for (urohxe6t = 1; urohxe6t <= *wy1vqfzu; urohxe6t++) {
          *fpdlcqk9btwy += tlgduey8[ayfnwr1v-1 + (urohxe6t-1) * *lqsahu0r] * g9fvdrbw[2];
          fpdlcqk9btwy++;
      }

      fapc0tnbybnagt8k(&ayfnwr1v, &yq6lorbx, &yu6izdrc,
                     g9fvdrbw, wkumc9idosiz4fxy, rbne6ouj,
                     &bvsquk3z, &bvsquk3z, wy1vqfzu, ldk,
                     kvowz9ht, lqsahu0r, wkumc9idtgiyxdw1, wkumc9iddufozmt7);
      fapc0tnbybnagt8k(&ayfnwr1v, &yq6lorbx, &pqneb2ra,
                     g9fvdrbw, wkumc9idosiz4fxy, rbne6ouj,
                     &bvsquk3z, &h2dpsbkr, wy1vqfzu, ldk,
                     kvowz9ht, lqsahu0r, wkumc9idtgiyxdw1, wkumc9iddufozmt7);

      yq6lorbx = dqlr5bse - 4 + 4;
      fpdlcqk9btwy = wkumc9idbtwy + (yq6lorbx-1) * *wy1vqfzu;
      for (urohxe6t = 1; urohxe6t <= *wy1vqfzu; urohxe6t++) {
          *fpdlcqk9btwy += tlgduey8[ayfnwr1v-1 + (urohxe6t-1) * *lqsahu0r] * g9fvdrbw[3];
          fpdlcqk9btwy++;
      }

      fapc0tnbybnagt8k(&ayfnwr1v, &yq6lorbx, &yu6izdrc,
                     g9fvdrbw, wkumc9idosiz4fxy, rbne6ouj,
                     &h2dpsbkr, &h2dpsbkr, wy1vqfzu, ldk,
                     kvowz9ht, lqsahu0r, wkumc9idtgiyxdw1, wkumc9iddufozmt7);
  }



  fapc0tnbtfeswo7c(wkumc9idosiz4fxy, acpios9q, wy1vqfzu, ldk, lamvec,
                xecbg0pf, z4grbpiq, d7glzhbj, v2eydbxs);

  arm0lkbg1 = *acpios9q * *wy1vqfzu;
  arm0lkbg2 = *ldk - 1;
  F77_CALL(vdpbfa7)(wkumc9idosiz4fxy, ldk, &arm0lkbg1, &arm0lkbg2,
                    aalgpft4y, wkumc9idwk0);


  if (*aalgpft4y) {
      Rprintf("Error in subroutine vdpbfa7; inside Yee_spline.\n");
      Rprintf("*aalgpft4y = %3d\n", *aalgpft4y);
      Free_fapc0tnbvsplin(wkumc9idosiz4fxy,  wkumc9idenaqpzk9,
                         wkumc9idbtwy,   wkumc9idwk0,    wkumc9idbk3ymcih,
                         wkumc9idtgiyxdw1, wkumc9iddufozmt7);
      return;
  }

  arm0lkbg1 = *acpios9q * *wy1vqfzu;
  arm0lkbg2 = *ldk - 1;
  F77_CALL(vdpbsl7)(wkumc9idosiz4fxy, ldk, &arm0lkbg1, &arm0lkbg2,
                    wkumc9idbtwy, wkumc9idwk0);


  fpdlcqk9btwy = wkumc9idbtwy;
  for (ayfnwr1v = 1; ayfnwr1v <= *acpios9q; ayfnwr1v++) {
      for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
          rpyis2kc[    ayfnwr1v-1 + (yq6lorbx-1) * *acpios9q] = *fpdlcqk9btwy++;
      }
  }

  fapc0tnbcn8kzpab(gkdx5jal, sjwyig9t, rpyis2kc,
                lqsahu0r, acpios9q, wy1vqfzu, t8hwvalr);



  arm0lkbg1 = *acpios9q * *wy1vqfzu;
  arm0lkbg2 = *ldk - 1;
  fapc0tnbvicb2(wkumc9idenaqpzk9, wkumc9idosiz4fxy, wkumc9idwk0,
               &arm0lkbg2, &arm0lkbg1);

  fapc0tnbicpd0omv(wkumc9idenaqpzk9, sjwyig9t, gkdx5jal, ui8ysltq,
                 ldk, lqsahu0r, acpios9q, wy1vqfzu, yzoe1rsp,
                 rbne6ouj, ifys6woa, kvowz9ht, ftnjamu2);


  Free_fapc0tnbvsplin(wkumc9idosiz4fxy,  wkumc9idenaqpzk9,
                     wkumc9idbtwy,   wkumc9idwk0,    wkumc9idbk3ymcih,
                     wkumc9idtgiyxdw1, wkumc9iddufozmt7);
}



void fapc0tnbcn8kzpab(double gkdx5jals[], double sjwyig9t[], double rpyis2kc[],
                   int *lqsahu0r, int *acpios9q, int *wy1vqfzu, double t8hwvalr[]) {


  int    ayfnwr1v, yq6lorbx, yu6izdrc = 0, h2dpsbkr = 4;
  double *chw8lzty;


  for (yq6lorbx = 0; yq6lorbx < *wy1vqfzu; yq6lorbx++) {
      chw8lzty = sjwyig9t;
      for (ayfnwr1v = 0; ayfnwr1v < *lqsahu0r; ayfnwr1v++) {
          F77_CALL(wbvalue)(gkdx5jals, rpyis2kc, acpios9q, &h2dpsbkr,
                            chw8lzty++, &yu6izdrc, t8hwvalr++);
      }
      rpyis2kc += *acpios9q;
  }
}


void Free_fapc0tnbvsuff9(double *wkumc9idwk1a,    double *wkumc9idwk1b,
                        double *wkumc9idwk2a,    double *wkumc9idwk2b,
                        double *wkumc9ideshvo2ic,   double *wkumc9idonxjvw8u,
                        int    *wkumc9idtgiyxdw11, int    *wkumc9iddufozmt71,
                        int    *wkumc9idtgiyxdw12, int    *wkumc9iddufozmt72,
                        int    *iz2nbfjc) {
  Free(wkumc9idwk1a);     Free(wkumc9idwk1b);
  Free(wkumc9idwk2a);     Free(wkumc9idwk2b);
  if (! *iz2nbfjc) {
      Free(wkumc9ideshvo2ic);
      Free(wkumc9idonxjvw8u);
  }
  Free(wkumc9idtgiyxdw11);  Free(wkumc9iddufozmt71);
  Free(wkumc9idtgiyxdw12);  Free(wkumc9iddufozmt72);
}


void vsuff9(int *ftnjamu2, int *lqsahu0r, int ezlgm2up[],
                   double sjwyig9t[], double tlgduey8[], double rbne6ouj[],
                   double pygsw6ko[], double pasjmo8g[], double eshvo2ic[],
                   double ueshvo2ic[], double onxjvw8u[], int *dvhw1ulq,
                   int *wy1vqfzu, int *kvowz9ht, int *npjlv3mr,
                   double conmat[], int *kgwmz4ip,
                   int *iz2nbfjc, int *wueshvo2ic,
                   int *npjlv3mreshvo2ic, int *dim2eshvo2ic) {





  double     *qnwamo0e, *qnwamo0e1, *qnwamo0e2;
  int        ayfnwr1v, yq6lorbx, gp1jxzuh, urohxe6t, bpvaqm5z, *ptri;
  int  pqneb2ra = 1;




  double *wkumc9idwk1a,    *wkumc9idwk1b,   *wkumc9idwk2a,   *wkumc9idwk2b,
         *wkumc9ideshvo2ic,   *wkumc9idonxjvw8u;
  int    *wkumc9idtgiyxdw11, *wkumc9iddufozmt71,
         *wkumc9idtgiyxdw12, *wkumc9iddufozmt72;
  int    zyojx5hw    = *wy1vqfzu   *  *wy1vqfzu,
         imk5wjxg   = *wy1vqfzu   * (*wy1vqfzu   + 1) / 2,
         n2colb = *kgwmz4ip *  *kgwmz4ip,
         n3colb = *kgwmz4ip * (*kgwmz4ip + 1) / 2;

  wkumc9idwk1a    = Calloc(zyojx5hw          , double);
  wkumc9idwk1b    = Calloc(*wy1vqfzu         , double);
  wkumc9idwk2a    = Calloc(n2colb       , double);
  wkumc9idwk2b    = Calloc(*kgwmz4ip       , double);
  wkumc9idtgiyxdw11 = Calloc(imk5wjxg         , int);
  wkumc9iddufozmt71 = Calloc(imk5wjxg         , int);
  wkumc9idtgiyxdw12 = Calloc(n3colb       , int);
  wkumc9iddufozmt72 = Calloc(n3colb       , int);

  if (*iz2nbfjc) {
      if (*npjlv3mr < *kvowz9ht || *kgwmz4ip != *wy1vqfzu) {
          Rprintf("Error in fapc0tnbvsuff9: ");
          Rprintf("must have npjlv3mr >= kvowz9ht & kgwmz4ip = M\n");
          Free_fapc0tnbvsuff9(wkumc9idwk1a,    wkumc9idwk1b,
                             wkumc9idwk2a,    wkumc9idwk2b,
                             wkumc9ideshvo2ic,   wkumc9idonxjvw8u,
                             wkumc9idtgiyxdw11, wkumc9iddufozmt71,
                             wkumc9idtgiyxdw12, wkumc9iddufozmt72,
                             iz2nbfjc);
          *dvhw1ulq = 0;
          return;
      }
  } else {
      if (*npjlv3mreshvo2ic < n3colb || *dim2eshvo2ic < n3colb) {
          Rprintf("Error in fapc0tnbvsuff9 with nontrivial constraints:\n");
          Rprintf("must have npjlv3mreshvo2ic and dim2eshvo2ic both >= n3colb\n");
          Free_fapc0tnbvsuff9(wkumc9idwk1a,    wkumc9idwk1b,
                             wkumc9idwk2a,    wkumc9idwk2b,
                             wkumc9ideshvo2ic,   wkumc9idonxjvw8u,
                             wkumc9idtgiyxdw11, wkumc9iddufozmt71,
                             wkumc9idtgiyxdw12, wkumc9iddufozmt72,
                             iz2nbfjc);
          *dvhw1ulq = 0;
          return;
      }

      wkumc9ideshvo2ic   = Calloc(*lqsahu0r *  zyojx5hw    , double);
      wkumc9idonxjvw8u  = Calloc(*lqsahu0r * *wy1vqfzu    , double);
  }


  fvlmz9iyC_qpsedg8x(wkumc9idtgiyxdw11, wkumc9iddufozmt71, wy1vqfzu);
  fvlmz9iyC_qpsedg8x(wkumc9idtgiyxdw12, wkumc9iddufozmt72, kgwmz4ip);

  ptri = ezlgm2up;  qnwamo0e = sjwyig9t;
  for (ayfnwr1v = 0; ayfnwr1v < *ftnjamu2; ayfnwr1v++) {
      pygsw6ko[(*ptri++) - 1] = *qnwamo0e++;
  }

  if (*iz2nbfjc) {
      qnwamo0e = onxjvw8u;
      for (yq6lorbx = 0; yq6lorbx < *wy1vqfzu; yq6lorbx++) {
          for (ayfnwr1v = 0; ayfnwr1v < *lqsahu0r; ayfnwr1v++) {
              *qnwamo0e++ = 0.0e0;
          }
      }
  }

  if (*iz2nbfjc) {
      qnwamo0e = eshvo2ic;
      for (yq6lorbx = 1; yq6lorbx <= *dim2eshvo2ic; yq6lorbx++) {
          for (ayfnwr1v = 1; ayfnwr1v <= *lqsahu0r; ayfnwr1v++) {
              *qnwamo0e++ = 0.0e0;
          }
      }
  }

  for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
      for (yq6lorbx = 1; yq6lorbx <= *kvowz9ht; yq6lorbx++) {
          wkumc9idwk1a[wkumc9idtgiyxdw11[yq6lorbx-1]-1 +
                   (wkumc9iddufozmt71[yq6lorbx-1]-1) * *wy1vqfzu] =
          wkumc9idwk1a[wkumc9iddufozmt71[yq6lorbx-1]-1 +
                   (wkumc9idtgiyxdw11[yq6lorbx-1]-1) * *wy1vqfzu] =
               rbne6ouj[ayfnwr1v-1 + (yq6lorbx-1)    * *ftnjamu2];
      }

      qnwamo0e1 = (*iz2nbfjc) ? eshvo2ic  : wkumc9ideshvo2ic;
      qnwamo0e2 = (*iz2nbfjc) ? onxjvw8u : wkumc9idonxjvw8u;
      for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
          for (gp1jxzuh = 1; gp1jxzuh <= *wy1vqfzu; gp1jxzuh++) {
                    qnwamo0e2[ezlgm2up[ayfnwr1v-1]-1 + (yq6lorbx-1) * *lqsahu0r] +=
                      wkumc9idwk1a[yq6lorbx   -1 + (gp1jxzuh-1) * *wy1vqfzu] *
                           tlgduey8[ayfnwr1v   -1 + (gp1jxzuh-1) * *ftnjamu2];
          }
      }
      for (yq6lorbx = 1; yq6lorbx <= *kvowz9ht; yq6lorbx++) {
               qnwamo0e1[ezlgm2up[ayfnwr1v-1]-1 + (yq6lorbx-1) * *lqsahu0r] +=
                     rbne6ouj[ayfnwr1v   -1 + (yq6lorbx-1) * *ftnjamu2];
      }
  }

  *dvhw1ulq = 1;
  if (*iz2nbfjc) {
      for (ayfnwr1v = 1; ayfnwr1v <= *lqsahu0r; ayfnwr1v++) {
          for (yq6lorbx = 1; yq6lorbx <= *kvowz9ht; yq6lorbx++) {
              wkumc9idwk1a[wkumc9idtgiyxdw11[yq6lorbx-1]-1 +
                       (wkumc9iddufozmt71[yq6lorbx-1]-1) * *wy1vqfzu] =
              wkumc9idwk1a[wkumc9iddufozmt71[yq6lorbx-1]-1 +
                       (wkumc9idtgiyxdw11[yq6lorbx-1]-1) * *wy1vqfzu] =
                   eshvo2ic[ayfnwr1v-1 + (yq6lorbx-1)    * *lqsahu0r];
          }
          for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
           wkumc9idwk1b[yq6lorbx-1] =      onxjvw8u[ayfnwr1v-1 + (yq6lorbx-1) * *lqsahu0r];
          }

          fvlmz9iyjdbomp0g(wkumc9idwk1a, wkumc9idwk1b, wy1vqfzu, dvhw1ulq, &pqneb2ra);
          if (*dvhw1ulq != 1) {
              Rprintf("*dvhw1ulq != 1 after fvlmz9iyjdbomp0g in vsuff9.\n");
              Free_fapc0tnbvsuff9(wkumc9idwk1a,    wkumc9idwk1b,
                                 wkumc9idwk2a,    wkumc9idwk2b,
                                 wkumc9ideshvo2ic,   wkumc9idonxjvw8u,
                                 wkumc9idtgiyxdw11, wkumc9iddufozmt71,
                                 wkumc9idtgiyxdw12, wkumc9iddufozmt72,
                                 iz2nbfjc);
              return;
          }
          if (*wueshvo2ic) {
              for (yq6lorbx = 1; yq6lorbx <= *npjlv3mreshvo2ic; yq6lorbx++) {
                  ueshvo2ic[yq6lorbx-1 + (ayfnwr1v-1) * *npjlv3mreshvo2ic] =
                    wkumc9idwk1a[wkumc9idtgiyxdw11[yq6lorbx-1]-1 +
                             (wkumc9iddufozmt71[yq6lorbx-1]-1) * *wy1vqfzu];
              }
          }
          for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
              pasjmo8g[ayfnwr1v-1 + (yq6lorbx-1) * *lqsahu0r] = wkumc9idwk1b[yq6lorbx-1];
          }
      }
  } else {
      qnwamo0e = wkumc9idwk1a;
      for (yq6lorbx = 1; yq6lorbx <= zyojx5hw; yq6lorbx++) {
          *qnwamo0e++ = 0.0e0;
      }

      for (ayfnwr1v = 1; ayfnwr1v <= *lqsahu0r; ayfnwr1v++) {

          for (yq6lorbx = 1; yq6lorbx <= *kvowz9ht; yq6lorbx++) {
              wkumc9idwk1a[wkumc9idtgiyxdw11[yq6lorbx-1]-1 +
                       (wkumc9iddufozmt71[yq6lorbx-1]-1) * *wy1vqfzu] =
              wkumc9idwk1a[wkumc9iddufozmt71[yq6lorbx-1]-1 +
                       (wkumc9idtgiyxdw11[yq6lorbx-1]-1) * *wy1vqfzu] =
              wkumc9ideshvo2ic[ayfnwr1v-1 + (yq6lorbx-1)    * *lqsahu0r];
          }
          for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
           wkumc9idwk1b[yq6lorbx-1] = wkumc9idonxjvw8u[ayfnwr1v-1 + (yq6lorbx-1) * *lqsahu0r];
          }

          for (yq6lorbx = 1; yq6lorbx <= *kgwmz4ip; yq6lorbx++) {
              for (gp1jxzuh = yq6lorbx; gp1jxzuh <= *kgwmz4ip; gp1jxzuh++) {
                  wkumc9idwk2a[yq6lorbx-1 + (gp1jxzuh-1) * *kgwmz4ip] = 0.0e0;
                  for (urohxe6t = 1; urohxe6t <= *wy1vqfzu; urohxe6t++) {
                      for (bpvaqm5z = 1; bpvaqm5z <= *wy1vqfzu; bpvaqm5z++) {
                         wkumc9idwk2a[yq6lorbx-1 + (gp1jxzuh-1) * *kgwmz4ip] +=
                            conmat[urohxe6t-1 + (yq6lorbx-1) * *wy1vqfzu] *
                         wkumc9idwk1a[urohxe6t-1 + (bpvaqm5z-1) * *wy1vqfzu] *
                            conmat[bpvaqm5z-1 + (gp1jxzuh-1) * *wy1vqfzu];
                      }
                  }
              }
          }

          for (yq6lorbx = 1; yq6lorbx <= *dim2eshvo2ic; yq6lorbx++) {
              eshvo2ic[ayfnwr1v-1 + (yq6lorbx-1) * *lqsahu0r] =
                wkumc9idwk2a[wkumc9idtgiyxdw12[yq6lorbx-1]-1 +
                         (wkumc9iddufozmt72[yq6lorbx-1]-1) * *kgwmz4ip];
          }

    for (yq6lorbx = 1; yq6lorbx <= *kgwmz4ip; yq6lorbx++) {
        wkumc9idwk2b[yq6lorbx-1] = 0.0e0;
        for (urohxe6t = 1; urohxe6t <= *wy1vqfzu; urohxe6t++) {
            wkumc9idwk2b[yq6lorbx-1] +=    conmat[urohxe6t-1 + (yq6lorbx-1) * *wy1vqfzu] *
                                   wkumc9idwk1b[urohxe6t-1];
      }
  }

          for (yq6lorbx = 1; yq6lorbx <= *kgwmz4ip; yq6lorbx++) {
              onxjvw8u[ayfnwr1v-1 + (yq6lorbx-1) * *lqsahu0r] = wkumc9idwk2b[yq6lorbx-1];
          }

          fvlmz9iyjdbomp0g(wkumc9idwk2a, wkumc9idwk2b, kgwmz4ip, dvhw1ulq, &pqneb2ra);
          if (*dvhw1ulq != 1) {
              Rprintf("*dvhw1ulq!=1 in vchol-vsuff9. Something gone wrong\n");
              Free_fapc0tnbvsuff9(wkumc9idwk1a,    wkumc9idwk1b,
                                 wkumc9idwk2a,    wkumc9idwk2b,
                                 wkumc9ideshvo2ic,   wkumc9idonxjvw8u,
                                 wkumc9idtgiyxdw11, wkumc9iddufozmt71,
                                 wkumc9idtgiyxdw12, wkumc9iddufozmt72,
                                 iz2nbfjc);
              return;
          }

          if (*wueshvo2ic) {
              for (yq6lorbx = 1; yq6lorbx <= *npjlv3mreshvo2ic; yq6lorbx++) {
                  ueshvo2ic[yq6lorbx-1 + (ayfnwr1v-1) * *npjlv3mreshvo2ic] =
                  wkumc9idwk2a[wkumc9idtgiyxdw12[yq6lorbx-1]-1  +
                           (wkumc9iddufozmt72[yq6lorbx-1]-1) * *kgwmz4ip];
              }
          }

          for (yq6lorbx = 1; yq6lorbx <= *kgwmz4ip; yq6lorbx++) {
              pasjmo8g[ayfnwr1v-1 + (yq6lorbx-1) * *lqsahu0r] = wkumc9idwk2b[yq6lorbx-1];
          }
      }
  }

  Free_fapc0tnbvsuff9(wkumc9idwk1a,    wkumc9idwk1b,
                     wkumc9idwk2a,    wkumc9idwk2b,
                     wkumc9ideshvo2ic,   wkumc9idonxjvw8u,
                     wkumc9idtgiyxdw11, wkumc9iddufozmt71,
                     wkumc9idtgiyxdw12, wkumc9iddufozmt72,
                     iz2nbfjc);
}


void fapc0tnbicpd0omv(double enaqpzk9[], double sjwyig9t[], double gkdx5jals[],
                double grmuyvx9[],
                int *ldk, int *lqsahu0r, int *acpios9q, int *wy1vqfzu, int *jzwsy6tp,
                double rbne6ouj[], double ifys6woa[], int *kvowz9ht, int *ftnjamu2) {


  int    ayfnwr1v, yq6lorbx, gp1jxzuh, urohxe6t, bpvaqm5z, dqlr5bse, pqzfxw4i;
  double ms0qypiw[16], g9fvdrbw[4], qaltf0nz = 0.10e-9;

  int    arm0lkbg1, arm0lkbg4, *ptri1, *ptri2;
  double  tmp_var4,  tmp_var5, *qnwamo0e;
  double *wkumc9idwrk,    *wkumc9idbmb;
  int    *wkumc9idtgiyxdw1_, *wkumc9iddufozmt7_,
         imk5wjxg  = *wy1vqfzu * (*wy1vqfzu + 1) / 2,
         zyojx5hw   = *wy1vqfzu * *wy1vqfzu;
  wkumc9idtgiyxdw1_ = Calloc(imk5wjxg, int);
  wkumc9iddufozmt7_ = Calloc(imk5wjxg, int);
  fvlmz9iyC_qpsedg8x(wkumc9idtgiyxdw1_, wkumc9iddufozmt7_, wy1vqfzu);
  ptri1 = wkumc9idtgiyxdw1_;   ptri2 = wkumc9iddufozmt7_;
  for (ayfnwr1v = 0; ayfnwr1v < imk5wjxg; ayfnwr1v++) {
      (*ptri1++)--;  (*ptri2++)--;
  }

  wkumc9idwrk = Calloc(zyojx5hw, double);
  wkumc9idbmb = Calloc(zyojx5hw, double);






  if (*jzwsy6tp) {
      qnwamo0e = grmuyvx9;
      for (gp1jxzuh = 1; gp1jxzuh <= *wy1vqfzu; gp1jxzuh++) {
          for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
              *qnwamo0e++  = 0.0e0;
          }
      }
  }

  for (ayfnwr1v = 1; ayfnwr1v <= *lqsahu0r; ayfnwr1v++) {

      qnwamo0e = wkumc9idbmb;
      for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
          for (gp1jxzuh = 1; gp1jxzuh <= *wy1vqfzu; gp1jxzuh++) {
              *qnwamo0e++ = 0.0e0;
          }
      }

      arm0lkbg1 = *acpios9q + 1;
      F77_CALL(vinterv)(gkdx5jals, &arm0lkbg1, sjwyig9t + ayfnwr1v-1,
                        &dqlr5bse, &pqzfxw4i);

      if (pqzfxw4i == 1) {
          if (sjwyig9t[ayfnwr1v-1] <= (gkdx5jals[dqlr5bse-1] + qaltf0nz)) {
              dqlr5bse--;
          } else {
              Rprintf("pqzfxw4i!=1 after vinterv called in fapc0tnbicpd0omv\n");
              Free(wkumc9idtgiyxdw1_);   Free(wkumc9iddufozmt7_);
              Free(wkumc9idwrk);
              return;
          }
      }
      arm0lkbg1 = 1;
      arm0lkbg4 = 4;
      F77_CALL(vbsplvd)(gkdx5jals, &arm0lkbg4, sjwyig9t + ayfnwr1v-1, &dqlr5bse,
                        ms0qypiw, g9fvdrbw, &arm0lkbg1);

      yq6lorbx = dqlr5bse - 4 + 1;


      for (urohxe6t = yq6lorbx; urohxe6t <= (yq6lorbx + 3); urohxe6t++) {
          fapc0tnbvsel(&urohxe6t, &urohxe6t, wy1vqfzu, ldk,
                      enaqpzk9, wkumc9idwrk);

          tmp_var4 = pow(g9fvdrbw[urohxe6t-yq6lorbx], (double) 2.0);
          fapc0tnbo0xlszqr(wy1vqfzu, &tmp_var4, wkumc9idwrk, wkumc9idbmb);
      }

      for (urohxe6t = yq6lorbx; urohxe6t <= (yq6lorbx+3); urohxe6t++) {
          for (bpvaqm5z = urohxe6t+1; bpvaqm5z <= (yq6lorbx+3); bpvaqm5z++) {
              fapc0tnbvsel(&urohxe6t, &bpvaqm5z, wy1vqfzu, ldk,
                          enaqpzk9, wkumc9idwrk);
              tmp_var5 = 2.0 * g9fvdrbw[urohxe6t-yq6lorbx] * g9fvdrbw[bpvaqm5z-yq6lorbx];
              fapc0tnbo0xlszqr(wy1vqfzu, &tmp_var5, wkumc9idwrk, wkumc9idbmb);
          }
      }

      if (*jzwsy6tp) {
          for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
                grmuyvx9[ayfnwr1v-1 + (yq6lorbx-1) * *ftnjamu2] =
              wkumc9idbmb[yq6lorbx-1 + (yq6lorbx-1) * *wy1vqfzu];
          }
      }

      fapc0tnbovjnsmt2(wkumc9idbmb, rbne6ouj, ifys6woa,
                     wy1vqfzu, lqsahu0r, kvowz9ht, &ayfnwr1v,
                     wkumc9idtgiyxdw1_, wkumc9iddufozmt7_);
  }

  Free(wkumc9idtgiyxdw1_);    Free(wkumc9iddufozmt7_);
  Free(wkumc9idwrk);
  Free(wkumc9idbmb);
}


void fapc0tnbo0xlszqr(int *wy1vqfzu, double *g9fvdrbw, double *quc6khaf, double *bmb) {



  int    yq6lorbx, gp1jxzuh;
  double *qnwamo0e;



  qnwamo0e = quc6khaf;
  for (yq6lorbx = 0; yq6lorbx < *wy1vqfzu; yq6lorbx++) {
      for (gp1jxzuh = 0; gp1jxzuh < *wy1vqfzu; gp1jxzuh++) {
          *quc6khaf *= *g9fvdrbw;
          quc6khaf++;
      }
  }
  quc6khaf = qnwamo0e;
  for (yq6lorbx = 0; yq6lorbx < *wy1vqfzu; yq6lorbx++) {
      for (gp1jxzuh = 0; gp1jxzuh < *wy1vqfzu; gp1jxzuh++) {
          *bmb += *quc6khaf++;
          bmb++;
      }
  }
}


void fapc0tnbvsel(int *nurohxe6t, int *nbpvaqm5z, int *wy1vqfzu, int *ldk,
                 double minv[], double quc6khaf[]) {


  int    ayfnwr1v, yq6lorbx, biuvowq2, nbj8tdsk;
  double *qnwamo0e;



  qnwamo0e = quc6khaf;
  for (ayfnwr1v = 1; ayfnwr1v <= *wy1vqfzu; ayfnwr1v++) {
      for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
          *qnwamo0e++ = 0.0;
      }
  }

  if (*nurohxe6t != *nbpvaqm5z) {
      for (ayfnwr1v = 1; ayfnwr1v <= *wy1vqfzu; ayfnwr1v++) {
          biuvowq2 = (*nurohxe6t - 1) * *wy1vqfzu + ayfnwr1v;
          for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
              nbj8tdsk = (*nbpvaqm5z - 1) * *wy1vqfzu + yq6lorbx;
              quc6khaf[ayfnwr1v-1 + (yq6lorbx-1) * *wy1vqfzu] =
                  minv[*ldk - (nbj8tdsk-biuvowq2)-1 + (nbj8tdsk-1) * *ldk];
          }
      }
  } else {
      for (ayfnwr1v = 1; ayfnwr1v <= *wy1vqfzu; ayfnwr1v++) {
          biuvowq2 = (*nurohxe6t - 1) * *wy1vqfzu + ayfnwr1v;
          for (yq6lorbx = ayfnwr1v; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
              nbj8tdsk = (*nbpvaqm5z - 1) * *wy1vqfzu + yq6lorbx;
              quc6khaf[ayfnwr1v-1 + (yq6lorbx-1) * *wy1vqfzu] =
                  minv[*ldk - (nbj8tdsk-biuvowq2)-1 + (nbj8tdsk-1) * *ldk];
          }
      }
      for (ayfnwr1v = 1; ayfnwr1v <= *wy1vqfzu; ayfnwr1v++) {
          for (yq6lorbx = ayfnwr1v+1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
              quc6khaf[yq6lorbx-1 + (ayfnwr1v-1) * *wy1vqfzu] =
              quc6khaf[ayfnwr1v-1 + (yq6lorbx-1) * *wy1vqfzu];
          }
      }
  }
}


void fapc0tnbovjnsmt2(double bmb[], double rbne6ouj[],
                    double ifys6woa[],
                    int *wy1vqfzu, int *lqsahu0r, int *kvowz9ht, int *iii,
                    int tgiyxdw1_[], int dufozmt7_[]) {



  int    yq6lorbx, gp1jxzuh, urohxe6t, bpvaqm5z;
  double q6zdcwxk;

  int    zyojx5hw  = *wy1vqfzu *  *wy1vqfzu;
  double *wkumc9idwrk;
  wkumc9idwrk     = Calloc(zyojx5hw,  double);


  for (bpvaqm5z = 1; bpvaqm5z <= *wy1vqfzu; bpvaqm5z++) {
      for (urohxe6t = 1; urohxe6t <= *kvowz9ht; urohxe6t++) {
        yq6lorbx = tgiyxdw1_[urohxe6t-1]   + (dufozmt7_[urohxe6t-1]  ) * *wy1vqfzu;
        gp1jxzuh = dufozmt7_[urohxe6t-1]   + (tgiyxdw1_[urohxe6t-1]  ) * *wy1vqfzu;

        wkumc9idwrk[yq6lorbx] = 
        wkumc9idwrk[gp1jxzuh] = rbne6ouj[*iii-1 + (urohxe6t-1) * *lqsahu0r];
      }

      q6zdcwxk = 0.0e0;
      for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
          q6zdcwxk +=      bmb[bpvaqm5z-1 + (yq6lorbx-1) * *wy1vqfzu] *
                  wkumc9idwrk[yq6lorbx-1 + (bpvaqm5z-1) * *wy1vqfzu];
      }
      ifys6woa[*iii-1 + (bpvaqm5z-1) * *lqsahu0r] = q6zdcwxk;
  }

  Free(wkumc9idwrk);
}


void fapc0tnbvicb2(double enaqpzk9[], double wpuarq2m[], double Dvector[],
                  int *wy1vqfzu, int *f8yswcat) {


  int    ayfnwr1v, gp1jxzuh, urohxe6t, uplim, sedf7mxb, hofjnx2e, kij0gwer;





  int       Mplus1    = *wy1vqfzu + 1;
  int       Mp1Mp1    = Mplus1 * Mplus1;
  double    *wkumc9iduu;
  wkumc9iduu   = Calloc(Mp1Mp1,   double);

  enaqpzk9[*wy1vqfzu + (*f8yswcat-1) * Mplus1] = 1.0e0 / Dvector[*f8yswcat-1];

  hofjnx2e = *wy1vqfzu + 1;
  sedf7mxb = *f8yswcat + 1 - hofjnx2e;
  for (kij0gwer = sedf7mxb; kij0gwer <= *f8yswcat; kij0gwer++) {
      for (ayfnwr1v = 1; ayfnwr1v <= hofjnx2e; ayfnwr1v++) {
          wkumc9iduu[ayfnwr1v-1 + (kij0gwer-sedf7mxb) * Mplus1] =
             wpuarq2m[ayfnwr1v-1 + (kij0gwer-1   ) * Mplus1];
      }
  }

  for (ayfnwr1v = *f8yswcat-1; ayfnwr1v >= 1; ayfnwr1v--) {
      uplim = *wy1vqfzu < (*f8yswcat - ayfnwr1v) ? *wy1vqfzu : *f8yswcat - ayfnwr1v;

      for (urohxe6t = 1; urohxe6t <= uplim; urohxe6t++) {
          enaqpzk9[-urohxe6t+*wy1vqfzu + (ayfnwr1v+urohxe6t-1) * Mplus1] = 0.0e0;
          for (gp1jxzuh = 1; gp1jxzuh <= urohxe6t; gp1jxzuh++) {
              enaqpzk9[-urohxe6t + *wy1vqfzu + (ayfnwr1v+urohxe6t-1     ) * Mplus1] -=
            wkumc9iduu[-gp1jxzuh + *wy1vqfzu + (ayfnwr1v+gp1jxzuh - sedf7mxb) * Mplus1] *
        enaqpzk9[gp1jxzuh-urohxe6t + *wy1vqfzu + (ayfnwr1v+urohxe6t-1     ) * Mplus1];
          }

          for ( ; gp1jxzuh <= uplim; gp1jxzuh++) {
              enaqpzk9[-urohxe6t + *wy1vqfzu + (ayfnwr1v+urohxe6t-1     ) * Mplus1] -=
            wkumc9iduu[-gp1jxzuh + *wy1vqfzu + (ayfnwr1v+gp1jxzuh - sedf7mxb) * Mplus1] *
        enaqpzk9[urohxe6t-gp1jxzuh + *wy1vqfzu + (ayfnwr1v+gp1jxzuh-1     ) * Mplus1];
          }
      }

      enaqpzk9[*wy1vqfzu + (ayfnwr1v-1) * Mplus1] = 1.0e0 / Dvector[ayfnwr1v-1];
      for (urohxe6t = 1; urohxe6t <= uplim; urohxe6t++) {
                   enaqpzk9[  *wy1vqfzu + (ayfnwr1v        - 1   ) * Mplus1] -=
         wkumc9iduu[-urohxe6t + *wy1vqfzu + (ayfnwr1v+urohxe6t - sedf7mxb) * Mplus1] *
           enaqpzk9[-urohxe6t + *wy1vqfzu + (ayfnwr1v+urohxe6t - 1   ) * Mplus1];
      }

      if (ayfnwr1v == sedf7mxb) {
          if (--sedf7mxb < 1) {
              sedf7mxb = 1;
          } else {
              for (kij0gwer = hofjnx2e - 1; kij0gwer >= 1; kij0gwer--) {
                  for (gp1jxzuh = 1; gp1jxzuh <= hofjnx2e; gp1jxzuh++) {
                      wkumc9iduu[gp1jxzuh-1 +  kij0gwer    * Mplus1] =
                      wkumc9iduu[gp1jxzuh-1 + (kij0gwer-1) * Mplus1];
                  }
              }
              for (gp1jxzuh = 1; gp1jxzuh <= hofjnx2e; gp1jxzuh++) {
                  wkumc9iduu[gp1jxzuh-1] = wpuarq2m[gp1jxzuh-1 + (sedf7mxb-1) * Mplus1];
              }
          }
      }
  }

  Free(wkumc9iduu);
}












void Free_fapc0tnbewg7qruh(double *wkumc9idWrk1,
                        int    *wkumc9idges1xpkr,
                        double *wkumc9idbeta,   double *wkumc9idfasrkub3,
                        double *wkumc9idsout,   double *wkumc9idr0oydcxb,
                        double *wkumc9idub4xioar,   double *wkumc9ideffect,
                        double *wkumc9idueshvo2ic,   double *wkumc9ids0,
                        double *wkumc9idpygsw6ko,   double *wkumc9idpasjmo8g,
                        double *wkumc9ideshvo2ic,  double *wkumc9idonxjvw8u,
                        double *wkumc9idwk4) {
  Free(wkumc9idWrk1);
  Free(wkumc9idges1xpkr);
  Free(wkumc9idbeta);    Free(wkumc9idfasrkub3);
  Free(wkumc9idsout);    Free(wkumc9idr0oydcxb);
  Free(wkumc9idub4xioar);    Free(wkumc9ideffect);
  Free(wkumc9idueshvo2ic);  Free(wkumc9ids0);
  Free(wkumc9idpygsw6ko);    Free(wkumc9idpasjmo8g);
  Free(wkumc9ideshvo2ic);   Free(wkumc9idonxjvw8u);
  Free(wkumc9idwk4);
}


void fapc0tnbewg7qruh(double ci1oyxas[], double tlgduey8[], double rbne6ouj[],
         int *ftnjamu2, int *wy1vqfzu, int ezlgm2up[], int *lqsahu0r,
         double wbkq9zyi[], double lamvec[], double hdnw2fts[],
         double kispwgx3[], double ui8ysltq[],
         int *kvowz9ht, int *fbd5yktj, int *ldk, int *aalgpft4y, int *yzoe1rsp,
         double rpyis2kc[], double gkdx5jals[], double ifys6woa[], double conmat[],

         double xecbg0pf[], double z4grbpiq[], double d7glzhbj[], double v2eydbxs[],
         double *tt2, int *cvnjhg2u,

         int *acpios9q, int *iz2nbfjc, int *kgwmz4ip,
         int *npjlv3mr,
         int    itdcb8ilk[],
         double  tdcb8ilk[]) {


  int    ayfnwr1v, yq6lorbx, gp1jxzuh, qemj9asg, dvhw1ulq, infoqr_svdbx3tk,
         rutyk8mg = *lqsahu0r * *kgwmz4ip;
  int    pqneb2ra = 1, ybnsqgo9 = 101;
  int    xjc4ywlh   = 2 * *kgwmz4ip,
         kgwmz4ip2 = 2 * *kgwmz4ip;

  int    npjlv3mreshvo2ic = (*iz2nbfjc == 1) ? *npjlv3mr  : *kgwmz4ip * (*kgwmz4ip + 1) / 2,
         dim2eshvo2ic  = (*iz2nbfjc == 1) ? *kvowz9ht : *kgwmz4ip * (*kgwmz4ip + 1) / 2;

  double xmin, xrange, *fpdlcqk9ui8ysltq, *fpdlcqk9hdnw2fts, *fpdlcqk9ub4xioar, *fpdlcqk9ifys6woa,
         *fpdlcqk9pygsw6ko, dtad5vhsu, do3jyipdf, dpq0hfucn, pvofyg8z = 1.0e-7;

  int    *wkumc9idges1xpkr, maxrutyk8mgxjc4ywlh;
  double *wkumc9idWrk1,   *wkumc9idwk4;
  double *wkumc9idbeta,   *wkumc9idfasrkub3, *wkumc9idsout,
         *wkumc9idr0oydcxb,  *wkumc9idub4xioar,  *wkumc9ideffect,
         *wkumc9idueshvo2ic, *wkumc9ids0;
  double *wkumc9idpygsw6ko,   *wkumc9idpasjmo8g,
         *wkumc9ideshvo2ic,  *wkumc9idonxjvw8u;

  maxrutyk8mgxjc4ywlh = (rutyk8mg > xjc4ywlh) ? rutyk8mg : xjc4ywlh;
  wkumc9idWrk1   = Calloc(maxrutyk8mgxjc4ywlh                     , double);
  wkumc9idwk4      = Calloc(rutyk8mg * xjc4ywlh                   , double);

  wkumc9idges1xpkr = Calloc(kgwmz4ip2              , int);
  wkumc9idbeta   = Calloc(kgwmz4ip2              , double);
  wkumc9idfasrkub3  = Calloc(kgwmz4ip2              , double);
  wkumc9idsout   = Calloc(*lqsahu0r  * *kgwmz4ip     , double);
  wkumc9idr0oydcxb  = Calloc(*kgwmz4ip * *lqsahu0r      , double);
  wkumc9idub4xioar   = Calloc(*kgwmz4ip * *lqsahu0r      , double);
  wkumc9ideffect = Calloc(*lqsahu0r  * *kgwmz4ip     , double);
  wkumc9idueshvo2ic = Calloc(npjlv3mreshvo2ic * *lqsahu0r  , double);
  wkumc9ids0     = Calloc(kgwmz4ip2 * kgwmz4ip2 * 2 , double);
  wkumc9idpygsw6ko   = Calloc(*lqsahu0r               , double);
  wkumc9idpasjmo8g   = Calloc(*lqsahu0r * *kgwmz4ip      , double);
  wkumc9idonxjvw8u = Calloc(*lqsahu0r * *kgwmz4ip      , double);
  wkumc9ideshvo2ic  = Calloc(*lqsahu0r *  dim2eshvo2ic  , double);




         vsuff9(ftnjamu2, lqsahu0r, ezlgm2up,
                ci1oyxas, tlgduey8, rbne6ouj,
                wkumc9idpygsw6ko, wkumc9idpasjmo8g, wkumc9ideshvo2ic,
                wkumc9idueshvo2ic, wkumc9idonxjvw8u, &dvhw1ulq,
                wy1vqfzu, kvowz9ht, npjlv3mr,
                conmat, kgwmz4ip,
                iz2nbfjc, &pqneb2ra,
                &npjlv3mreshvo2ic, &dim2eshvo2ic);

  if (dvhw1ulq != 1) {
    Rprintf("Error in fapc0tnbewg7qruh after calling vsuff9.\n");
    Free_fapc0tnbewg7qruh(wkumc9idWrk1,
                       wkumc9idges1xpkr,
                       wkumc9idbeta,   wkumc9idfasrkub3,
                       wkumc9idsout,   wkumc9idr0oydcxb,
                       wkumc9idub4xioar,   wkumc9ideffect,
                       wkumc9idueshvo2ic, wkumc9ids0,
                       wkumc9idpygsw6ko,   wkumc9idpasjmo8g,
                       wkumc9ideshvo2ic,  wkumc9idonxjvw8u,
                       wkumc9idwk4);
    return;
  }

  xmin = wkumc9idpygsw6ko[0];
  xrange = wkumc9idpygsw6ko[*lqsahu0r-1] - wkumc9idpygsw6ko[0];
  for (ayfnwr1v = 1; ayfnwr1v <= *lqsahu0r; ayfnwr1v++) {
      wkumc9idpygsw6ko[ayfnwr1v-1] = (wkumc9idpygsw6ko[ayfnwr1v-1] - xmin) / xrange;
  }

  *ldk = 4 * *kgwmz4ip;
  *ldk = 3 * *kgwmz4ip + 1;

  *fbd5yktj = 0;


  for (yq6lorbx = 1; yq6lorbx <= *kgwmz4ip; yq6lorbx++) {
      if (wbkq9zyi[yq6lorbx-1] == 0.0e0) {
          hdnw2fts[yq6lorbx-1] += 1.0e0;
      }
  }

  Yee_spline(wkumc9idpygsw6ko, wkumc9idonxjvw8u, wkumc9ideshvo2ic, gkdx5jals,
                lqsahu0r, acpios9q, ldk, kgwmz4ip, &dim2eshvo2ic,
                wbkq9zyi, lamvec, aalgpft4y, wkumc9idsout,
                rpyis2kc, ui8ysltq, ifys6woa, hdnw2fts,
                yzoe1rsp, fbd5yktj, ftnjamu2,
                xecbg0pf, z4grbpiq, d7glzhbj, v2eydbxs,
                tt2, cvnjhg2u,
                itdcb8ilk,
                tdcb8ilk);


  fpdlcqk9hdnw2fts = hdnw2fts;
  for (yq6lorbx = 1; yq6lorbx <= *kgwmz4ip; yq6lorbx++) {
      *fpdlcqk9hdnw2fts = -1.0e0;
       fpdlcqk9ifys6woa = ifys6woa + (yq6lorbx-1) * *ftnjamu2;
      for (ayfnwr1v = 1; ayfnwr1v <= *lqsahu0r; ayfnwr1v++) {
             *fpdlcqk9hdnw2fts += *fpdlcqk9ifys6woa++;
      }
      fpdlcqk9hdnw2fts++;
  }


  if (*kgwmz4ip >= 1) {

      fapc0tnbx6kanjdh(wkumc9idpygsw6ko, wkumc9idwk4, lqsahu0r, kgwmz4ip);

      rutyk8mg = *lqsahu0r * *kgwmz4ip;

      fvlmz9iyC_mxrbkut0(wkumc9idueshvo2ic, wkumc9idwk4,
                   kgwmz4ip, &xjc4ywlh, lqsahu0r, &npjlv3mreshvo2ic, &rutyk8mg);

      for (gp1jxzuh = 1; gp1jxzuh <= xjc4ywlh; gp1jxzuh++) {
          wkumc9idges1xpkr[gp1jxzuh-1] = gp1jxzuh;
      }
      F77_CALL(vqrdca)(wkumc9idwk4, &rutyk8mg, &rutyk8mg, &xjc4ywlh, wkumc9idfasrkub3,
                       wkumc9idges1xpkr, wkumc9idWrk1, &qemj9asg, &pvofyg8z);

      fvlmz9iyC_nudh6szq(wkumc9idueshvo2ic, wkumc9idsout, wkumc9idr0oydcxb,
                   &npjlv3mreshvo2ic, lqsahu0r, kgwmz4ip);

      F77_CALL(vdqrsl)(wkumc9idwk4, &rutyk8mg, &rutyk8mg, &qemj9asg, wkumc9idfasrkub3,
                       wkumc9idr0oydcxb, wkumc9idWrk1, wkumc9ideffect, wkumc9idbeta,
                       wkumc9idWrk1, wkumc9idub4xioar, &ybnsqgo9, &infoqr_svdbx3tk);


      fvlmz9iyC_vbks(wkumc9idueshvo2ic, wkumc9idub4xioar, kgwmz4ip, lqsahu0r, &npjlv3mreshvo2ic);

      if (*yzoe1rsp) {

          fvlmz9iyC_lkhnw9yq(wkumc9idwk4, wkumc9ids0, &rutyk8mg, &xjc4ywlh, &dvhw1ulq);

          if (dvhw1ulq != 1) {
            Rprintf("Error in fapc0tnbewg7qruh calling fvlmz9iyC_lkhnw9yq.\n");
            Free_fapc0tnbewg7qruh(wkumc9idWrk1,
                               wkumc9idges1xpkr,
                               wkumc9idbeta,   wkumc9idfasrkub3,
                               wkumc9idsout,   wkumc9idr0oydcxb,
                               wkumc9idub4xioar,   wkumc9ideffect,
                               wkumc9idueshvo2ic, wkumc9ids0,
                               wkumc9idpygsw6ko,   wkumc9idpasjmo8g,
                               wkumc9ideshvo2ic,  wkumc9idonxjvw8u,
                               wkumc9idwk4);
            return;
          }

          for (yq6lorbx = 1; yq6lorbx <= *kgwmz4ip; yq6lorbx++) {
            dtad5vhsu = wkumc9ids0[yq6lorbx-1 + (yq6lorbx-1         ) * kgwmz4ip2];
            do3jyipdf = wkumc9ids0[yq6lorbx-1 + (yq6lorbx-1 + *kgwmz4ip) * kgwmz4ip2];
            dpq0hfucn = wkumc9ids0[yq6lorbx-1 + *kgwmz4ip +
                                         (yq6lorbx-1 + *kgwmz4ip) * kgwmz4ip2];
            fpdlcqk9ui8ysltq =  ui8ysltq + (yq6lorbx-1) * *ftnjamu2;
            fpdlcqk9pygsw6ko = wkumc9idpygsw6ko;
            for (ayfnwr1v = 1; ayfnwr1v <= *lqsahu0r; ayfnwr1v++) {
                *fpdlcqk9ui8ysltq -= dtad5vhsu + *fpdlcqk9pygsw6ko *
                                (2.0 * do3jyipdf  + *fpdlcqk9pygsw6ko * dpq0hfucn);
                 fpdlcqk9ui8ysltq++;
                 fpdlcqk9pygsw6ko++;
              }
          }
      }
  } else {

      fapc0tnbdsrt0gem(lqsahu0r, wkumc9idpygsw6ko, wkumc9ideshvo2ic, wkumc9idsout,
                    wkumc9idub4xioar, ui8ysltq, yzoe1rsp);
  }


  fpdlcqk9ub4xioar = wkumc9idub4xioar;
  for (ayfnwr1v = 1; ayfnwr1v <= *lqsahu0r; ayfnwr1v++) {
      for (yq6lorbx = 1; yq6lorbx <= *kgwmz4ip; yq6lorbx++) {
          wkumc9idsout[ayfnwr1v-1 + (yq6lorbx-1) * *lqsahu0r] -= *fpdlcqk9ub4xioar++;
      }
  }


  for (yq6lorbx = 1; yq6lorbx <= *kgwmz4ip; yq6lorbx++) {
      fapc0tnbshm8ynte(ftnjamu2,  /* lqsahu0r, */
                    ezlgm2up, wkumc9idsout + (yq6lorbx-1) * *lqsahu0r,
                              kispwgx3 + (yq6lorbx-1) * *ftnjamu2);
  }

  Free_fapc0tnbewg7qruh(wkumc9idWrk1,
                     wkumc9idges1xpkr,
                     wkumc9idbeta,   wkumc9idfasrkub3,
                     wkumc9idsout,   wkumc9idr0oydcxb,
                     wkumc9idub4xioar,   wkumc9ideffect,
                     wkumc9idueshvo2ic, wkumc9ids0,
                     wkumc9idpygsw6ko,   wkumc9idpasjmo8g,
                     wkumc9ideshvo2ic,  wkumc9idonxjvw8u,
                     wkumc9idwk4);
}


void Yee_vbfa(int psdvgce3[], double *doubvec, double he7mqnvy[], double tlgduey8[],
       double rbne6ouj[], double hdnw2fts[], double lamvec[], double wbkq9zyi[],
       int ezlgm2up[], int lqsahu0r[], int which[],
       double kispwgx3[], double m0ibglfx[],
       double zshtfg8c[], double ui8ysltq[],
       double vc6hatuj[], double fasrkub3[], int ges1xpkr[],
       double wpuarq2m[], double hjm2ktyr[],
       int ulm3dvzg[], int hnpt1zym[], int iz2nbfjc[],
       double ifys6woa[],
       double rpyis2kc[], double gkdx5jals[],
       int nbzjkpi3[], int acpios9q[], int jwbkl9fp[]) {


  double *ghdetj8v, *zpcqv3uj;
  int    nhja0izq, rutyk8mg, xjc4ywlh, lyma1kwc, lyzoe1rsp, ueb8hndv, gtrlbz3e, algpft4y = 0,
         qemj9asg, npjlv3mr, kvowz9ht, ldk, fbd5yktj = 0;









    int    *ftnjamu2, *wy1vqfzu;
    int     itdcb8ilk[1];
    double   tdcb8ilk[4];

  itdcb8ilk[0] = psdvgce3[15];
   tdcb8ilk[0] = doubvec[2];
   tdcb8ilk[1] = doubvec[3];
   tdcb8ilk[2] = doubvec[4];
   tdcb8ilk[3] = doubvec[5];

  wy1vqfzu         = psdvgce3 + 7;
  ftnjamu2        = psdvgce3;
  nhja0izq        = psdvgce3[2];
  lyzoe1rsp      = psdvgce3[3];
  gtrlbz3e      = psdvgce3[5];
  qemj9asg  = psdvgce3[6];

  rutyk8mg   = psdvgce3[8];
  xjc4ywlh   = psdvgce3[9];
  lyma1kwc   = psdvgce3[10];
  kvowz9ht = psdvgce3[11];
  npjlv3mr  = psdvgce3[12];
  ldk         = psdvgce3[14];

  zpcqv3uj = doubvec + 0;;
  ghdetj8v = doubvec + 1;

  fapc0tnbvbfa1(ftnjamu2, wy1vqfzu, ezlgm2up, lqsahu0r, which,
               he7mqnvy, tlgduey8, rbne6ouj,
               wbkq9zyi, lamvec, hdnw2fts,
               kispwgx3, m0ibglfx, zshtfg8c,
               ui8ysltq, zpcqv3uj, vc6hatuj, fasrkub3,
               &qemj9asg, ges1xpkr, wpuarq2m, hjm2ktyr,
               ulm3dvzg, hnpt1zym, iz2nbfjc,
               ifys6woa,
               rpyis2kc, gkdx5jals, ghdetj8v,
               nbzjkpi3, acpios9q, jwbkl9fp,
               &nhja0izq, &lyzoe1rsp, &ueb8hndv, &gtrlbz3e,
               &rutyk8mg, &xjc4ywlh,
               &kvowz9ht, &npjlv3mr, &fbd5yktj, &ldk, &algpft4y,
               itdcb8ilk,
                tdcb8ilk);

  psdvgce3[6] = qemj9asg;
  psdvgce3[4] = ueb8hndv;
  psdvgce3[13] = fbd5yktj;
  psdvgce3[16] = algpft4y;
}



void fapc0tnbvbfa1(int *ftnjamu2, int *wy1vqfzu, int ezlgm2up[], int lqsahu0r[], int which[],
            double he7mqnvy[], double tlgduey8[], double rbne6ouj[],
            double wbkq9zyi[], double lamvec[], double hdnw2fts[],
            double kispwgx3[], double m0ibglfx[], double zshtfg8c[],
            double ui8ysltq[], double *zpcqv3uj, double vc6hatuj[], double fasrkub3[],
            int *qemj9asg, int ges1xpkr[], double wpuarq2m[], double hjm2ktyr[],
            int ulm3dvzg[], int hnpt1zym[], int iz2nbfjc[],
            double ifys6woa[],
            double rpyis2kc[], double gkdx5jals[], double *ghdetj8v,
            int nbzjkpi3[], int acpios9q[], int jwbkl9fp[],
            int *nhja0izq, int *yzoe1rsp, int *ueb8hndv, int *gtrlbz3e,
            int *rutyk8mg, int *xjc4ywlh,
            int *kvowz9ht, int *npjlv3mr, int *fbd5yktj, int *ldk, int *algpft4y,
            int     itdcb8ilk[],
            double   tdcb8ilk[]) {





  int    ayfnwr1v, yq6lorbx, gp1jxzuh, urohxe6t, bpvaqm5z, wg1xifdy, ybnsqgo9 = 101,
         maxrutyk8mgxjc4ywlh,  infoqr_svdbx3tk, sumzv2xfhei = 0;
  double qtce8hzo, deltaf, z4vrscot, pvofyg8z = 1.0e-7, g2dnwteb = 1.0,
         *fpdlcqk9m0ibglfx, *fpdlcqk9ub4xioar,   *fpdlcqk9tlgduey8, *fpdlcqk9ghz9vuba,
         *fpdlcqk9hjm2ktyr,  *fpdlcqk9kispwgx3, *qnwamo0e1;
  double *wkumc9idTwk,
         *wkumc9idwkbzmd6ftv,   *wkumc9idwk9;
  double *wkumc9idghz9vuba,    *wkumc9idoldmat,
         *wkumc9idub4xioar,    *wkumc9idwk2;
  double *wkumc9idall_xecbg0pf, *wkumc9idall_z4grbpiq, *wkumc9idall_d7glzhbj, *wkumc9idall_v2eydbxs,
         *wkumc9idall_tt2;
  int    cvnjhg2u;

  maxrutyk8mgxjc4ywlh   = (*ftnjamu2 * *wy1vqfzu > *xjc4ywlh) ? (*ftnjamu2 * *wy1vqfzu) : *xjc4ywlh;
  wkumc9idTwk      = Calloc(maxrutyk8mgxjc4ywlh      , double);

  wkumc9idwkbzmd6ftv    = Calloc(*xjc4ywlh * *rutyk8mg, double);
  wkumc9idwk9      = Calloc(*xjc4ywlh        , double);

  wkumc9idghz9vuba     = Calloc(*ftnjamu2 *  *wy1vqfzu, double);
  wkumc9idoldmat   = Calloc(*ftnjamu2 *  *wy1vqfzu, double);
  wkumc9idub4xioar     = Calloc(*wy1vqfzu  * *ftnjamu2, double);
  wkumc9idwk2      = Calloc(*ftnjamu2 *  *wy1vqfzu, double);




  if (   *nhja0izq == 0
      || *nhja0izq == 1
     ) {
      *gtrlbz3e = 1;
  }

  if (*qemj9asg == 0) {
      fvlmz9iyC_mxrbkut0(wpuarq2m, vc6hatuj, wy1vqfzu, xjc4ywlh, ftnjamu2, npjlv3mr, rutyk8mg);

      for (gp1jxzuh = 1; gp1jxzuh <= *xjc4ywlh; gp1jxzuh++) {
          ges1xpkr[gp1jxzuh-1] = gp1jxzuh;
      }
      F77_CALL(vqrdca)(vc6hatuj, rutyk8mg, rutyk8mg, xjc4ywlh, fasrkub3,
                       ges1xpkr, wkumc9idTwk, qemj9asg, &pvofyg8z);
  }

  fpdlcqk9m0ibglfx = m0ibglfx;
  for (ayfnwr1v = 0; ayfnwr1v < *ftnjamu2; ayfnwr1v++) {
      for (yq6lorbx = 0; yq6lorbx < *wy1vqfzu; yq6lorbx++) {
          *fpdlcqk9m0ibglfx++ = 0.0e0;
      }
  }

  for (gp1jxzuh = 1; gp1jxzuh <= *nhja0izq; gp1jxzuh++) {
      if (iz2nbfjc[gp1jxzuh-1] == 1) {
          fpdlcqk9m0ibglfx = m0ibglfx;
          for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
              bpvaqm5z = hnpt1zym[gp1jxzuh-1] - 1;
              for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
                  *fpdlcqk9m0ibglfx += kispwgx3[ayfnwr1v-1 +  bpvaqm5z     * *ftnjamu2];
                  fpdlcqk9m0ibglfx++;
                  bpvaqm5z++;
              }
          }
      } else {
          for (wg1xifdy = 1; wg1xifdy <= ulm3dvzg[gp1jxzuh-1]; wg1xifdy++) {
              urohxe6t = hnpt1zym[gp1jxzuh-1] + wg1xifdy - 2;
              fpdlcqk9m0ibglfx = m0ibglfx;
              fpdlcqk9kispwgx3 = kispwgx3 + urohxe6t * *ftnjamu2;
              for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
                  fpdlcqk9hjm2ktyr = hjm2ktyr + urohxe6t * *wy1vqfzu;
                  for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
                      *fpdlcqk9m0ibglfx += *fpdlcqk9hjm2ktyr++ * *fpdlcqk9kispwgx3;
                      fpdlcqk9m0ibglfx++;
                  }
                  fpdlcqk9kispwgx3++;
              }
          }
      }
  }


  sumzv2xfhei = jwbkl9fp[(1 + *nhja0izq)  - 1];
  wkumc9idall_xecbg0pf = Calloc(sumzv2xfhei, double);
  wkumc9idall_z4grbpiq = Calloc(sumzv2xfhei, double);
  wkumc9idall_d7glzhbj = Calloc(sumzv2xfhei, double);
  wkumc9idall_v2eydbxs = Calloc(sumzv2xfhei, double);
  wkumc9idall_tt2 = Calloc(*nhja0izq   , double);


  *ueb8hndv = 0;

  while ((g2dnwteb > *zpcqv3uj ) && (*ueb8hndv < *gtrlbz3e)) {

      (*ueb8hndv)++;
      deltaf = 0.0e0;
      fpdlcqk9ghz9vuba = wkumc9idghz9vuba;  fpdlcqk9tlgduey8 = tlgduey8;
      for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
          fpdlcqk9m0ibglfx = m0ibglfx + yq6lorbx-1;
          for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
              *fpdlcqk9ghz9vuba++  = *fpdlcqk9tlgduey8++ - *fpdlcqk9m0ibglfx;
               fpdlcqk9m0ibglfx   += *wy1vqfzu;
          }
      }

      fvlmz9iyC_nudh6szq(wpuarq2m, wkumc9idghz9vuba, wkumc9idTwk, npjlv3mr, ftnjamu2, wy1vqfzu);

      F77_CALL(vdqrsl)(vc6hatuj, rutyk8mg, rutyk8mg, qemj9asg, fasrkub3,
                       wkumc9idTwk, wkumc9idwk2, wkumc9idwk2, zshtfg8c,
                       wkumc9idwk2, wkumc9idub4xioar, &ybnsqgo9, &infoqr_svdbx3tk);

      *ghdetj8v = 0.0e0;
      qnwamo0e1 = wkumc9idTwk;  fpdlcqk9ub4xioar = wkumc9idub4xioar;
      for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
          for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
              qtce8hzo =   *qnwamo0e1++ - *fpdlcqk9ub4xioar++;
              *ghdetj8v += pow(qtce8hzo, (double) 2.0);
          }
      }

      fvlmz9iyC_vbks(wpuarq2m, wkumc9idub4xioar, wy1vqfzu, ftnjamu2, npjlv3mr);

      for (gp1jxzuh = 1; gp1jxzuh <= *nhja0izq; gp1jxzuh++) {
          for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
              urohxe6t = hnpt1zym[gp1jxzuh-1] + yq6lorbx -2;
              if (iz2nbfjc[gp1jxzuh-1] == 1) {
                  for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
                    wkumc9idoldmat[ayfnwr1v-1 + (yq6lorbx-1) * *ftnjamu2] =
                         kispwgx3[ayfnwr1v-1 +  urohxe6t    * *ftnjamu2];

                      wkumc9idghz9vuba[ayfnwr1v-1 + (yq6lorbx-1) * *ftnjamu2] =
                           tlgduey8[ayfnwr1v-1 + (yq6lorbx-1) * *ftnjamu2] -
                      wkumc9idub4xioar[yq6lorbx-1 + (ayfnwr1v-1) * *wy1vqfzu]  -
                         m0ibglfx[yq6lorbx-1 + (ayfnwr1v-1) * *wy1vqfzu]  +
                    wkumc9idoldmat[ayfnwr1v-1 + (yq6lorbx-1) * *ftnjamu2];
                  }
              } else {
                for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
                  wkumc9idoldmat[ayfnwr1v-1 + (yq6lorbx-1) * *ftnjamu2] = 0.0e0;
                  for (wg1xifdy = 1; wg1xifdy <= ulm3dvzg[gp1jxzuh-1]; wg1xifdy++) {
                      bpvaqm5z = hnpt1zym[gp1jxzuh-1] + wg1xifdy -2;
                      wkumc9idoldmat[ayfnwr1v-1 + (yq6lorbx-1) * *ftnjamu2] +=
                            hjm2ktyr[yq6lorbx-1 +  bpvaqm5z    * *wy1vqfzu] *
                           kispwgx3[ayfnwr1v-1 +  bpvaqm5z    * *ftnjamu2];
                  }
                    wkumc9idghz9vuba[ayfnwr1v-1 + (yq6lorbx-1) * *ftnjamu2] =
                         tlgduey8[ayfnwr1v-1 + (yq6lorbx-1) * *ftnjamu2] -
                    wkumc9idub4xioar[yq6lorbx-1 + (ayfnwr1v-1) * *wy1vqfzu]  -
                       m0ibglfx[yq6lorbx-1 + (ayfnwr1v-1) * *wy1vqfzu]  +
                  wkumc9idoldmat[ayfnwr1v-1 + (yq6lorbx-1) * *ftnjamu2];
                }
              }
          }

          cvnjhg2u = (*ueb8hndv == 1) ? 0 : 1;
          fapc0tnbewg7qruh(he7mqnvy+(which[gp1jxzuh-1]-1) * *ftnjamu2, wkumc9idghz9vuba, rbne6ouj,
              ftnjamu2, wy1vqfzu,   ezlgm2up + (gp1jxzuh-1)   * *ftnjamu2, lqsahu0r + gp1jxzuh-1,
                 wbkq9zyi +  hnpt1zym[gp1jxzuh-1]-1,
                 lamvec +  hnpt1zym[gp1jxzuh-1]-1,
                 hdnw2fts +  hnpt1zym[gp1jxzuh-1]-1,
                 kispwgx3 + (hnpt1zym[gp1jxzuh-1]-1) * *ftnjamu2,
                 ui8ysltq + (hnpt1zym[gp1jxzuh-1]-1) * *ftnjamu2,
              kvowz9ht, fbd5yktj, ldk, algpft4y, yzoe1rsp,
                 rpyis2kc + nbzjkpi3[gp1jxzuh-1]-1,
                gkdx5jals + jwbkl9fp[gp1jxzuh-1]-1,
                 ifys6woa + (hnpt1zym[gp1jxzuh-1]-1) * *ftnjamu2,
                 hjm2ktyr  + (hnpt1zym[gp1jxzuh-1]-1) * *wy1vqfzu,

              wkumc9idall_xecbg0pf + jwbkl9fp[gp1jxzuh-1]-1,
              wkumc9idall_z4grbpiq + jwbkl9fp[gp1jxzuh-1]-1,
              wkumc9idall_d7glzhbj + jwbkl9fp[gp1jxzuh-1]-1,
              wkumc9idall_v2eydbxs + jwbkl9fp[gp1jxzuh-1]-1,
              wkumc9idall_tt2 +        gp1jxzuh-1   ,
 // If 0 then compute wkumc9idall_sg[0:3] else already done:
              &cvnjhg2u,

              acpios9q + gp1jxzuh-1, iz2nbfjc + gp1jxzuh-1, ulm3dvzg + gp1jxzuh-1,
              npjlv3mr,
              itdcb8ilk,
               tdcb8ilk);

          for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
              if (iz2nbfjc[gp1jxzuh-1] == 1) {
                  for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
                    m0ibglfx[yq6lorbx-1 +                (ayfnwr1v-1) * *wy1vqfzu] +=
                    kispwgx3[ayfnwr1v-1 + (hnpt1zym[gp1jxzuh-1]+yq6lorbx-2) * *ftnjamu2];
                  }
              } else {
                  for (wg1xifdy = 1; wg1xifdy <= ulm3dvzg[gp1jxzuh-1]; wg1xifdy++) {
                      for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
                     m0ibglfx[yq6lorbx-1+                (ayfnwr1v-1) * *wy1vqfzu] +=
                      hjm2ktyr[yq6lorbx-1+ (hnpt1zym[gp1jxzuh-1]+wg1xifdy-2) * *wy1vqfzu] *
                     kispwgx3[ayfnwr1v-1+ (hnpt1zym[gp1jxzuh-1]+wg1xifdy-2) * *ftnjamu2];
                      }
                  }
              }
              for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
                       m0ibglfx[yq6lorbx-1 + (ayfnwr1v-1) * *wy1vqfzu] -=
                  wkumc9idoldmat[ayfnwr1v-1 + (yq6lorbx-1) * *ftnjamu2];
              }
          }

          for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
              if (iz2nbfjc[gp1jxzuh-1] == 1) {
                  deltaf += fapc0tnbrd9beyfk(ftnjamu2,
                                        wkumc9idoldmat + (yq6lorbx-1) * *ftnjamu2,
                                              rbne6ouj + (yq6lorbx-1) * *ftnjamu2,
                              kispwgx3 + (hnpt1zym[gp1jxzuh-1]+yq6lorbx-2) * *ftnjamu2);
              } else {
                  for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
                      wkumc9idTwk[ayfnwr1v-1] = 0.0e0;
                      for (wg1xifdy=1; wg1xifdy<=ulm3dvzg[gp1jxzuh-1]; wg1xifdy++) {
                  wkumc9idTwk[ayfnwr1v-1] +=
                     hjm2ktyr[yq6lorbx-1  + (hnpt1zym[gp1jxzuh-1]+wg1xifdy-2) * *wy1vqfzu] *
                    kispwgx3[ayfnwr1v-1  + (hnpt1zym[gp1jxzuh-1]+wg1xifdy-2) * *ftnjamu2];
                      }
                  }
                  deltaf += fapc0tnbrd9beyfk(ftnjamu2,
                                  wkumc9idoldmat + (yq6lorbx-1) * *ftnjamu2,
                                        rbne6ouj + (yq6lorbx-1) * *ftnjamu2,
                                          wkumc9idTwk);
              }
          }

 
          fpdlcqk9ghz9vuba = wkumc9idghz9vuba;  fpdlcqk9tlgduey8 = tlgduey8;
          for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
              fpdlcqk9m0ibglfx = m0ibglfx + yq6lorbx-1;
              for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
                  *fpdlcqk9ghz9vuba++  = *fpdlcqk9tlgduey8++ - *fpdlcqk9m0ibglfx;
                   fpdlcqk9m0ibglfx += *wy1vqfzu;
              }
          }

          fvlmz9iyC_nudh6szq(wpuarq2m, wkumc9idghz9vuba, wkumc9idTwk, npjlv3mr, ftnjamu2, wy1vqfzu);

          F77_CALL(vdqrsl)(vc6hatuj, rutyk8mg, rutyk8mg, qemj9asg, fasrkub3,
                           wkumc9idTwk, wkumc9idwk2, wkumc9idwk2, zshtfg8c,
                           wkumc9idwk2, wkumc9idub4xioar, &ybnsqgo9, &infoqr_svdbx3tk);

          fvlmz9iyC_vbks(wpuarq2m, wkumc9idub4xioar, wy1vqfzu, ftnjamu2, npjlv3mr);

      }

      if (*nhja0izq > 0) {
          z4vrscot = 0.0e0;
          for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
              for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
                z4vrscot += rbne6ouj[ayfnwr1v-1 + (yq6lorbx-1) * *ftnjamu2] *
                    pow(m0ibglfx[yq6lorbx-1 + (ayfnwr1v-1) * *wy1vqfzu], (double) 2.0);
              }
          }
          g2dnwteb = (z4vrscot > 0.0e0) ? sqrt(deltaf / z4vrscot) : 0.0;
      }

      if (*ueb8hndv == 1) {
          g2dnwteb = 1.0e0;
      }
  }

  for (yq6lorbx = 1; yq6lorbx <= *xjc4ywlh; yq6lorbx++) {
      wkumc9idwk9[yq6lorbx-1] = zshtfg8c[yq6lorbx-1];
  }
  for (yq6lorbx = 1; yq6lorbx <= *xjc4ywlh; yq6lorbx++) {
      zshtfg8c[ges1xpkr[yq6lorbx-1]-1] = wkumc9idwk9[yq6lorbx-1];
  }

  fpdlcqk9m0ibglfx = m0ibglfx;  fpdlcqk9ub4xioar = wkumc9idub4xioar;
  for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
      for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
          *fpdlcqk9m0ibglfx   += *fpdlcqk9ub4xioar++;
           fpdlcqk9m0ibglfx++;
      }
  }

  if (*yzoe1rsp && (*nhja0izq > 0)) {
      for (gp1jxzuh = 1; gp1jxzuh <= *nhja0izq; gp1jxzuh++) {
          for (wg1xifdy = 1; wg1xifdy <= ulm3dvzg[gp1jxzuh-1]; wg1xifdy++) {
              fapc0tnbshm8ynte(ftnjamu2, /* lqsahu0r + gp1jxzuh-1, */
                                 ezlgm2up + (gp1jxzuh-1)             * *ftnjamu2,
                          ui8ysltq + (hnpt1zym[ gp1jxzuh-1] + wg1xifdy-2) * *ftnjamu2,
                            wkumc9idoldmat);
              for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
                      ui8ysltq[ayfnwr1v-1 + (hnpt1zym[gp1jxzuh-1]+wg1xifdy-2) * *ftnjamu2] =
                 wkumc9idoldmat[ayfnwr1v-1];
              }
          }
      }

      for (gp1jxzuh = 1; gp1jxzuh <= *nhja0izq; gp1jxzuh++) {
          for (wg1xifdy = 1; wg1xifdy <= ulm3dvzg[gp1jxzuh-1]; wg1xifdy++) {
              fapc0tnbshm8ynte(ftnjamu2, /* lqsahu0r + gp1jxzuh-1, */
                                 ezlgm2up + (gp1jxzuh-1)             * *ftnjamu2,
                          ifys6woa + (hnpt1zym[ gp1jxzuh-1] + wg1xifdy-2) * *ftnjamu2,
                            wkumc9idoldmat);
              for (ayfnwr1v = 1; ayfnwr1v <= *ftnjamu2; ayfnwr1v++) {
                      ifys6woa[ayfnwr1v-1 + (hnpt1zym[gp1jxzuh-1]+wg1xifdy-2) * *ftnjamu2] =
                 wkumc9idoldmat[ayfnwr1v-1];
              }

          }
      }
  }

  Free(wkumc9idwkbzmd6ftv);     Free(wkumc9idwk9);
  Free(wkumc9idTwk);
  Free(wkumc9idghz9vuba);      Free(wkumc9idoldmat);
  Free(wkumc9idub4xioar);      Free(wkumc9idwk2);
  Free(wkumc9idall_xecbg0pf);   Free(wkumc9idall_z4grbpiq);
  Free(wkumc9idall_d7glzhbj);   Free(wkumc9idall_v2eydbxs);
  Free(wkumc9idall_tt2);
}


void fapc0tnbx6kanjdh(double sjwyig9t[], double xout[], int *f8yswcat, int *wy1vqfzu) {


  int  ayfnwr1v, yq6lorbx, gp1jxzuh, iptr = 0;



  for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
      for (ayfnwr1v = 1; ayfnwr1v <= *f8yswcat; ayfnwr1v++) {
          for (gp1jxzuh = 1; gp1jxzuh <= *wy1vqfzu; gp1jxzuh++) {
              xout[iptr++] = (yq6lorbx == gp1jxzuh) ? 1.0e0 : 0.0e0;
          }
      }
  }

  for (yq6lorbx = 1; yq6lorbx <= *wy1vqfzu; yq6lorbx++) {
      for (ayfnwr1v = 1; ayfnwr1v <= *f8yswcat; ayfnwr1v++) {
          for (gp1jxzuh = 1; gp1jxzuh <= *wy1vqfzu; gp1jxzuh++) {
              xout[iptr++] = (yq6lorbx == gp1jxzuh) ? sjwyig9t[ayfnwr1v-1] : 0.0e0;
          }
      }
  }
}


double fapc0tnbrd9beyfk(int *f8yswcat, double bhcji9gl[], double po8rwsmy[],
                     double m0ibglfx[]) {


  int    ayfnwr1v;
  double rd9beyfk, rxeqjn0y = 0.0, lm9vcjob = 0.0;

  for (ayfnwr1v = 0; ayfnwr1v < *f8yswcat; ayfnwr1v++) {
      lm9vcjob    += *po8rwsmy;
      rxeqjn0y    += *po8rwsmy++ * pow(*bhcji9gl++ - *m0ibglfx++, (double) 2.0);
  }
  rd9beyfk = (lm9vcjob > 0.0e0) ? (rxeqjn0y / lm9vcjob) : 0.0e0;
  return rd9beyfk;
}


void fapc0tnbpitmeh0q(int *f8yswcat, double bhcji9gl[], double po8rwsmy[],
                    double *lfu2qhid, double *lm9vcjob) {


  double rxeqjn0yy = 0.0;
  int    ayfnwr1v;

  *lm9vcjob = 0.0e0;
  for (ayfnwr1v = 0; ayfnwr1v < *f8yswcat; ayfnwr1v++) {
      *lm9vcjob  += *po8rwsmy;
      rxeqjn0yy  += *po8rwsmy++ * *bhcji9gl++;
  }
  *lfu2qhid = (*lm9vcjob > 0.0e0) ? (rxeqjn0yy / *lm9vcjob) : 0.0e0;
}


void fapc0tnbdsrt0gem(int *f8yswcat, double sjwyig9t[], double po8rwsmy[], double bhcji9gl[],
                   double ub4xioar[], double ui8ysltq[], int *yzoe1rsp) {


  int    ayfnwr1v;
  double pygsw6ko, pasjmo8g, intercept, eck8vubt, qtce8hzo,
         lm9vcjob = 0.0, q6zdcwxk = 0.0, nsum = 0.0,
         *fpdlcqk9po8rwsmy, *fpdlcqk9sjwyig9t, *fpdlcqk9bhcji9gl;



  fapc0tnbpitmeh0q(f8yswcat, sjwyig9t, po8rwsmy, &pygsw6ko, &lm9vcjob);
  fapc0tnbpitmeh0q(f8yswcat, bhcji9gl, po8rwsmy, &pasjmo8g, &lm9vcjob);

  fpdlcqk9sjwyig9t = sjwyig9t;  fpdlcqk9bhcji9gl = bhcji9gl;  fpdlcqk9po8rwsmy = po8rwsmy; 
  for (ayfnwr1v = 0; ayfnwr1v < *f8yswcat; ayfnwr1v++) {
      qtce8hzo = *fpdlcqk9sjwyig9t++ - pygsw6ko;
      nsum  += qtce8hzo * (*fpdlcqk9bhcji9gl++ - pasjmo8g) * *fpdlcqk9po8rwsmy;
      qtce8hzo = pow(qtce8hzo, (double) 2.0);
      q6zdcwxk  += qtce8hzo * *fpdlcqk9po8rwsmy++;
  }

  eck8vubt = nsum / q6zdcwxk;
  intercept = pasjmo8g - eck8vubt * pygsw6ko;
  fpdlcqk9sjwyig9t = sjwyig9t; 
  for (ayfnwr1v = 0; ayfnwr1v < *f8yswcat; ayfnwr1v++) {
      *ub4xioar++ = intercept + eck8vubt * *fpdlcqk9sjwyig9t++;
  }

  if (*yzoe1rsp) {
      fpdlcqk9sjwyig9t = sjwyig9t;  fpdlcqk9po8rwsmy = po8rwsmy;
      for (ayfnwr1v = 0; ayfnwr1v < *f8yswcat; ayfnwr1v++) {
          qtce8hzo = *fpdlcqk9sjwyig9t++ - pygsw6ko;
          if (*fpdlcqk9po8rwsmy++ > 0.0e0) {
             *ui8ysltq -= (1.0e0 / lm9vcjob + pow(qtce8hzo, (double) 2.0) / q6zdcwxk);
              ui8ysltq++;
          } else {
             *ui8ysltq++ = 0.0e0;
          }
      }
  }
}


void fapc0tnbshm8ynte(int *ftnjamu2,
                   int ezlgm2up[], double pygsw6ko[], double sjwyig9t[]) {


  int  ayfnwr1v;


  for (ayfnwr1v = 0; ayfnwr1v < *ftnjamu2; ayfnwr1v++) {
      *sjwyig9t++ = pygsw6ko[*ezlgm2up++ -1];
  }
}


void vknootl2(double sjwyig9t[], int *f8yswcat, double gkdx5jal[], int *rvy1fpli,
              int *ukgwt7na) {


  int  ayfnwr1v, yq6lorbx, ndzv2xfhei;


  if (*ukgwt7na) {
      ndzv2xfhei = *rvy1fpli - 6;
  } else {
      ndzv2xfhei = (*f8yswcat <= 40) ? *f8yswcat : floor((double) 40.0 +
                           pow((double) *f8yswcat - 40.0, (double) 0.25));
  }

  *rvy1fpli = ndzv2xfhei + 6;


  for (yq6lorbx = 1; yq6lorbx <= 3; yq6lorbx++) {
    *gkdx5jal++ = sjwyig9t[0];
  }

  for (yq6lorbx = 1; yq6lorbx <= ndzv2xfhei; yq6lorbx++) {
    ayfnwr1v = (yq6lorbx - 1) * (*f8yswcat - 1) / (ndzv2xfhei - 1);
    *gkdx5jal++ = sjwyig9t[ayfnwr1v];
  }

  for (yq6lorbx = 1; yq6lorbx <= 3; yq6lorbx++) {
    *gkdx5jal++ = sjwyig9t[*f8yswcat -1];
  }
}


void Yee_pknootl2(double *gkdx5jal, int *f8yswcat, int *zo8wpibx, double *Toler_ankcghz2) {





  int  ayfnwr1v, yq6lorbx = *f8yswcat - 4, cjop5bwm = 4;

  for (ayfnwr1v = 1; ayfnwr1v <= 4; ayfnwr1v++) {
    *zo8wpibx++ = 1;
  }

  for (ayfnwr1v = 5; ayfnwr1v <= yq6lorbx; ayfnwr1v++) {
      if ((gkdx5jal[ayfnwr1v -1] - gkdx5jal[cjop5bwm -1] >= *Toler_ankcghz2) &&
          (gkdx5jal[  *f8yswcat -1] - gkdx5jal[ayfnwr1v -1] >= *Toler_ankcghz2)) {
          *zo8wpibx++ = 1;
          cjop5bwm = ayfnwr1v;
      } else {
          *zo8wpibx++ = 0;
      }
  }

  for (ayfnwr1v = *f8yswcat - 3; ayfnwr1v <= *f8yswcat; ayfnwr1v++) {
    *zo8wpibx++ = 1;
  }
}




Generated by  Doxygen 1.6.0   Back to index