[BACK]Return to mh-r.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / hgm / mh / src

Annotation of OpenXM/src/hgm/mh/src/mh-r.c, Revision 1.9

1.9     ! takayama    1: /* $OpenXM: OpenXM/src/hgm/mh/src/mh-r.c,v 1.8 2014/03/16 03:11:07 takayama Exp $
1.1       takayama    2:  R interface module
                      3: */
                      4:
                      5: #include <stdio.h>
                      6: #include "sfile.h"
                      7: #include "mh.h"
                      8: #define WSIZE 1024
                      9:
1.2       takayama   10: int Rmh_cwishart_gen(int *mp,int *np,double *beta,double *x0p,
1.8       takayama   11:                      int *approxDegp,double *hp, int *dpp, double *xp,
                     12:                      int *modep,int *rankp,
                     13:                      int *automaticp,double *assigned_series_errorp,int *verbosep,
                     14:                      double *xy) {
1.1       takayama   15:   struct cWishart *cw;
                     16:   int rank;
                     17:   int i;
                     18:   rank = *rankp;
1.8       takayama   19:   cw = mh_cwishart_gen(*mp,*np,beta,*x0p,*approxDegp,*hp,*dpp,*xp,modep,
                     20:                        *automaticp,*assigned_series_errorp,*verbosep);
1.1       takayama   21:   xy[0] = cw->x;
1.3       takayama   22:   for (i=1; i<=rank; i++) xy[i] = (cw->f)[i-1];
1.5       takayama   23:
                     24:   if ((modep[2] > 0) && cw->aux) {
                     25:     struct SFILE *sfp3;
                     26:     char *s3;
                     27:     char str[1024];
                     28:     double x;
                     29:     s3 = (char *)cw->aux;
                     30:     sfp3 = mh_fopen(s3,"r",0);
                     31:     for (i=cw->rank+1; i<modep[2]+(cw->rank)+1; i++) xy[i] = 0.0;
                     32:     for (i=cw->rank+1; i<modep[2]+(cw->rank)+1; i++) {
                     33:       if (!mh_fgets(str,1024,sfp3)) break;
                     34:       sscanf(str,"%lg",&x);
                     35:       xy[i] = x;
                     36:     }
                     37:   }
1.6       takayama   38:   return(0);
1.1       takayama   39: }
1.7       takayama   40:
                     41: int Rmh_set_strategy(int *m,double *err,double *ans) {
                     42:   mh_set_strategy(*m,err);
                     43:   ans[0] = 0.0;
                     44:   return(0);
                     45: }
1.9     ! takayama   46:
        !            47: int Rmh_pFq_gen(int *mp,
        !            48:                 int *pp, double *a,
        !            49:                 int *qp, double *b,
        !            50:                 int *ef_typep,
        !            51:                 double *beta,double *x0p,
        !            52:                 int *approxDegp,double *hp, int *dpp, double *xp,
        !            53:                 int *modep,int *rankp,
        !            54:                 int *automaticp,double *assigned_series_errorp,int *verbosep,
        !            55:                 double *xy) {
        !            56:   struct cWishart *cw;
        !            57:   int rank;
        !            58:   int i;
        !            59:   rank = *rankp;
        !            60:   cw = mh_pFq_gen(*mp,
        !            61:                   *pp,a,
        !            62:                   *qp,b,
        !            63:                   *ef_typep,
        !            64:                   beta,*x0p,*approxDegp,*hp,*dpp,*xp,modep,
        !            65:                   *automaticp,*assigned_series_errorp,*verbosep);
        !            66:   xy[0] = cw->x;
        !            67:   for (i=1; i<=rank; i++) xy[i] = (cw->f)[i-1];
        !            68:
        !            69:   if ((modep[2] > 0) && cw->aux) {
        !            70:     struct SFILE *sfp3;
        !            71:     char *s3;
        !            72:     char str[1024];
        !            73:     double x;
        !            74:     s3 = (char *)cw->aux;
        !            75:     sfp3 = mh_fopen(s3,"r",0);
        !            76:     for (i=cw->rank+1; i<modep[2]+(cw->rank)+1; i++) xy[i] = 0.0;
        !            77:     for (i=cw->rank+1; i<modep[2]+(cw->rank)+1; i++) {
        !            78:       if (!mh_fgets(str,1024,sfp3)) break;
        !            79:       sscanf(str,"%lg",&x);
        !            80:       xy[i] = x;
        !            81:     }
        !            82:   }
        !            83:   return(0);
        !            84: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>