Use new types in cbind

merge-maint-par
sfilippone 1 month ago
parent 246992cb65
commit 463f5cc2eb

@ -11,7 +11,7 @@ amg_c_dprec* amg_c_dprec_new()
} }
psb_i_t amg_c_dprec_delete(amg_c_dprec* p) psb_c_i_t amg_c_dprec_delete(amg_c_dprec* p)
{ {
int iret; int iret;
iret=amg_c_dprecfree(p); iret=amg_c_dprecfree(p);

@ -17,25 +17,25 @@ extern "C" {
} amg_c_dprec; } amg_c_dprec;
amg_c_dprec* amg_c_dprec_new(); amg_c_dprec* amg_c_dprec_new();
psb_i_t amg_c_dprec_delete(amg_c_dprec* p); psb_c_i_t amg_c_dprec_delete(amg_c_dprec* p);
psb_i_t amg_c_dprecinit(psb_c_ctxt cctxt, amg_c_dprec *ph, const char *ptype); psb_c_i_t amg_c_dprecinit(psb_c_ctxt cctxt, amg_c_dprec *ph, const char *ptype);
psb_i_t amg_c_dprecseti(amg_c_dprec *ph, const char *what, psb_i_t val); psb_c_i_t amg_c_dprecseti(amg_c_dprec *ph, const char *what, psb_c_i_t val);
psb_i_t amg_c_dprecsetc(amg_c_dprec *ph, const char *what, const char *val); psb_c_i_t amg_c_dprecsetc(amg_c_dprec *ph, const char *what, const char *val);
psb_i_t amg_c_dprecsetr(amg_c_dprec *ph, const char *what, double val); psb_c_i_t amg_c_dprecsetr(amg_c_dprec *ph, const char *what, double val);
psb_i_t amg_c_dprecbld(psb_c_dspmat *ah, psb_c_descriptor *cdh, amg_c_dprec *ph); psb_c_i_t amg_c_dprecbld(psb_c_dspmat *ah, psb_c_descriptor *cdh, amg_c_dprec *ph);
psb_i_t amg_c_dhierarchy_build(psb_c_dspmat *ah, psb_c_descriptor *cdh, amg_c_dprec *ph); psb_c_i_t amg_c_dhierarchy_build(psb_c_dspmat *ah, psb_c_descriptor *cdh, amg_c_dprec *ph);
psb_i_t amg_c_dsmoothers_build(psb_c_dspmat *ah, psb_c_descriptor *cdh, amg_c_dprec *ph); psb_c_i_t amg_c_dsmoothers_build(psb_c_dspmat *ah, psb_c_descriptor *cdh, amg_c_dprec *ph);
psb_i_t amg_c_dsmoothers_build_opt(psb_c_dspmat *ah, psb_c_descriptor *cdh, amg_c_dprec *ph, const char *afmt, const char *chfmt); psb_c_i_t amg_c_dsmoothers_build_opt(psb_c_dspmat *ah, psb_c_descriptor *cdh, amg_c_dprec *ph, const char *afmt, const char *chfmt);
psb_i_t amg_c_dprecapply(amg_c_dprec *ph, psb_c_dvector *bh, psb_c_dvector *xh, psb_c_descriptor *cdh); psb_c_i_t amg_c_dprecapply(amg_c_dprec *ph, psb_c_dvector *bh, psb_c_dvector *xh, psb_c_descriptor *cdh);
psb_i_t amg_c_dprecapply_opt(amg_c_dprec *ph, psb_c_dvector *bh, psb_c_dvector *xh, psb_c_descriptor *cdh, const char *ctrans); psb_c_i_t amg_c_dprecapply_opt(amg_c_dprec *ph, psb_c_dvector *bh, psb_c_dvector *xh, psb_c_descriptor *cdh, const char *ctrans);
psb_i_t amg_c_dprecfree(amg_c_dprec *ph); psb_c_i_t amg_c_dprecfree(amg_c_dprec *ph);
psb_i_t amg_c_dprecbld_opt(psb_c_dspmat *ah, psb_c_descriptor *cdh, psb_c_i_t amg_c_dprecbld_opt(psb_c_dspmat *ah, psb_c_descriptor *cdh,
amg_c_dprec *ph, const char *afmt); amg_c_dprec *ph, const char *afmt);
psb_i_t amg_c_ddescr(amg_c_dprec *ph); psb_c_i_t amg_c_ddescr(amg_c_dprec *ph);
psb_i_t amg_c_dallocate_wrk(amg_c_dprec *ph, const char *chfmt); psb_c_i_t amg_c_dallocate_wrk(amg_c_dprec *ph, const char *chfmt);
psb_i_t amg_c_dkrylov(const char *method, psb_c_dspmat *ah, amg_c_dprec *ph, psb_c_i_t amg_c_dkrylov(const char *method, psb_c_dspmat *ah, amg_c_dprec *ph,
psb_c_dvector *bh, psb_c_dvector *xh, psb_c_dvector *bh, psb_c_dvector *xh,
psb_c_descriptor *cdh, psb_c_SolverOptions *opt); psb_c_descriptor *cdh, psb_c_SolverOptions *opt);

@ -11,7 +11,7 @@ amg_c_zprec* amg_c_new_zprec()
} }
psb_i_t amg_c_delete_zprec(amg_c_zprec* p) psb_c_i_t amg_c_delete_zprec(amg_c_zprec* p)
{ {
int iret; int iret;
iret=amg_c_zprecfree(p); iret=amg_c_zprecfree(p);

@ -19,26 +19,26 @@ extern "C"
} amg_c_zprec; } amg_c_zprec;
amg_c_zprec *amg_c_zprec_new(); amg_c_zprec *amg_c_zprec_new();
psb_i_t amg_c_zprec_delete(amg_c_zprec *p); psb_c_i_t amg_c_zprec_delete(amg_c_zprec *p);
psb_i_t amg_c_zprecinit(psb_c_ctxt cctxt, amg_c_zprec *ph, const char *ptype); psb_c_i_t amg_c_zprecinit(psb_c_ctxt cctxt, amg_c_zprec *ph, const char *ptype);
psb_i_t amg_c_zprecseti(amg_c_zprec *ph, const char *what, psb_i_t val); psb_c_i_t amg_c_zprecseti(amg_c_zprec *ph, const char *what, psb_c_i_t val);
psb_i_t amg_c_zprecsetc(amg_c_zprec *ph, const char *what, const char *val); psb_c_i_t amg_c_zprecsetc(amg_c_zprec *ph, const char *what, const char *val);
psb_i_t amg_c_zprecsetr(amg_c_zprec *ph, const char *what, double val); psb_c_i_t amg_c_zprecsetr(amg_c_zprec *ph, const char *what, double val);
psb_i_t amg_c_zprecbld(psb_c_zspmat *ah, psb_c_descriptor *cdh, amg_c_zprec *ph); psb_c_i_t amg_c_zprecbld(psb_c_zspmat *ah, psb_c_descriptor *cdh, amg_c_zprec *ph);
psb_i_t amg_c_zhierarchy_build(psb_c_zspmat *ah, psb_c_descriptor *cdh, amg_c_zprec *ph); psb_c_i_t amg_c_zhierarchy_build(psb_c_zspmat *ah, psb_c_descriptor *cdh, amg_c_zprec *ph);
psb_i_t amg_c_zsmoothers_build(psb_c_zspmat *ah, psb_c_descriptor *cdh, amg_c_zprec *ph); psb_c_i_t amg_c_zsmoothers_build(psb_c_zspmat *ah, psb_c_descriptor *cdh, amg_c_zprec *ph);
psb_i_t amg_c_zsmoothers_build_opt(psb_c_zspmat *ah, psb_c_descriptor *cdh, amg_c_zprec *ph, const char *afmt, const char *chfmt); psb_c_i_t amg_c_zsmoothers_build_opt(psb_c_zspmat *ah, psb_c_descriptor *cdh, amg_c_zprec *ph, const char *afmt, const char *chfmt);
psb_i_t amg_c_zprecapply(amg_c_zprec *ph, psb_c_zvector *bh, psb_c_zvector *xh, psb_c_descriptor *cdh); psb_c_i_t amg_c_zprecapply(amg_c_zprec *ph, psb_c_zvector *bh, psb_c_zvector *xh, psb_c_descriptor *cdh);
psb_i_t amg_c_zprecapply_opt(amg_c_zprec *ph, psb_c_zvector *bh, psb_c_zvector *xh, psb_c_descriptor *cdh, const char *ctrans); psb_c_i_t amg_c_zprecapply_opt(amg_c_zprec *ph, psb_c_zvector *bh, psb_c_zvector *xh, psb_c_descriptor *cdh, const char *ctrans);
psb_i_t amg_c_zprecfree(amg_c_zprec *ph); psb_c_i_t amg_c_zprecfree(amg_c_zprec *ph);
psb_i_t amg_c_zprecbld_opt(psb_c_zspmat *ah, psb_c_descriptor *cdh, psb_c_i_t amg_c_zprecbld_opt(psb_c_zspmat *ah, psb_c_descriptor *cdh,
amg_c_zprec *ph, const char *afmt); amg_c_zprec *ph, const char *afmt);
psb_i_t amg_c_zdescr(amg_c_zprec *ph); psb_c_i_t amg_c_zdescr(amg_c_zprec *ph);
psb_i_t amg_c_zallocate_wrk(amg_c_zprec *ph, const char *chfmt); psb_c_i_t amg_c_zallocate_wrk(amg_c_zprec *ph, const char *chfmt);
psb_i_t amg_c_zkrylov(const char *method, psb_c_zspmat *ah, amg_c_zprec *ph, psb_c_i_t amg_c_zkrylov(const char *method, psb_c_zspmat *ah, amg_c_zprec *ph,
psb_c_zvector *bh, psb_c_zvector *xh, psb_c_zvector *bh, psb_c_zvector *xh,
psb_c_descriptor *cdh, psb_c_SolverOptions *opt); psb_c_descriptor *cdh, psb_c_SolverOptions *opt);

@ -123,16 +123,16 @@ double g(double x, double y, double z)
#define NBMAX 20 #define NBMAX 20
psb_i_t matgen(psb_c_ctxt cctxt, psb_i_t nl, psb_i_t idim, psb_l_t vl[], psb_c_i_t matgen(psb_c_ctxt cctxt, psb_c_i_t nl, psb_c_i_t idim, psb_c_l_t vl[],
psb_c_dspmat *ah,psb_c_descriptor *cdh, psb_c_dspmat *ah,psb_c_descriptor *cdh,
psb_c_dvector *xh, psb_c_dvector *bh, psb_c_dvector *rh) psb_c_dvector *xh, psb_c_dvector *bh, psb_c_dvector *rh)
{ {
psb_i_t iam, np; psb_c_i_t iam, np;
psb_l_t ix, iy, iz, el,glob_row; psb_c_l_t ix, iy, iz, el,glob_row;
psb_i_t i, k, info,ret; psb_c_i_t i, k, info,ret;
double x, y, z, deltah, sqdeltah, deltah2; double x, y, z, deltah, sqdeltah, deltah2;
double val[10*NBMAX], zt[NBMAX]; double val[10*NBMAX], zt[NBMAX];
psb_l_t irow[10*NBMAX], icol[10*NBMAX]; psb_c_l_t irow[10*NBMAX], icol[10*NBMAX];
info = 0; info = 0;
psb_c_info(cctxt,&iam,&np); psb_c_info(cctxt,&iam,&np);
@ -254,15 +254,15 @@ void get_hparm(FILE *fp, char *val)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
psb_c_ctxt *cctxt; psb_c_ctxt *cctxt;
psb_i_t iam, np; psb_c_i_t iam, np;
char methd[40], ptype[40], afmt[8]; char methd[40], ptype[40], afmt[8];
psb_i_t nparms; psb_c_i_t nparms;
psb_i_t idim,info,istop,itmax,itrace,irst,iter,ret; psb_c_i_t idim,info,istop,itmax,itrace,irst,iter,ret;
amg_c_dprec *ph; amg_c_dprec *ph;
psb_c_dspmat *ah; psb_c_dspmat *ah;
psb_c_dvector *bh, *xh, *rh; psb_c_dvector *bh, *xh, *rh;
psb_i_t nb,nlr, nl; psb_c_i_t nb,nlr, nl;
psb_l_t i,ng, *vl, k; psb_c_l_t i,ng, *vl, k;
double t1,t2,eps,err; double t1,t2,eps,err;
double *xv, *bv, *rv; double *xv, *bv, *rv;
double one=1.0, zero=0.0, res2; double one=1.0, zero=0.0, res2;
@ -305,16 +305,16 @@ int main(int argc, char *argv[])
psb_c_set_index_base(0); psb_c_set_index_base(0);
/* Simple minded BLOCK data distribution */ /* Simple minded BLOCK data distribution */
ng = ((psb_l_t) idim)*idim*idim; ng = ((psb_c_l_t) idim)*idim*idim;
nb = (ng+np-1)/np; nb = (ng+np-1)/np;
nl = nb; nl = nb;
if ( (ng -iam*nb) < nl) nl = ng -iam*nb; if ( (ng -iam*nb) < nl) nl = ng -iam*nb;
fprintf(stderr,"%d: Input data %d %ld %d %d\n",iam,idim,ng,nb, nl); fprintf(stderr,"%d: Input data %d %ld %d %d\n",iam,idim,ng,nb, nl);
if ((vl=malloc(nb*sizeof(psb_l_t)))==NULL) { if ((vl=malloc(nb*sizeof(psb_c_l_t)))==NULL) {
fprintf(stderr,"On %d: malloc failure\n",iam); fprintf(stderr,"On %d: malloc failure\n",iam);
psb_c_abort(*cctxt); psb_c_abort(*cctxt);
} }
i = ((psb_l_t)iam) * nb; i = ((psb_c_l_t)iam) * nb;
for (k=0; k<nl; k++) for (k=0; k<nl; k++)
vl[k] = i+k; vl[k] = i+k;

@ -126,17 +126,17 @@ double g(double x, double y, double z)
#define NBMAX 20 #define NBMAX 20
psb_i_t matgen(psb_c_ctxt cctxt, psb_i_t nl, psb_i_t idim, psb_l_t vl[], psb_c_i_t matgen(psb_c_ctxt cctxt, psb_c_i_t nl, psb_c_i_t idim, psb_c_l_t vl[],
psb_c_dspmat *ah, const char *afmt, psb_c_dspmat *ah, const char *afmt,
psb_c_descriptor *cdh, const char *cdfmt, psb_c_descriptor *cdh, const char *cdfmt,
psb_c_dvector *xh, psb_c_dvector *bh, psb_c_dvector *rh) psb_c_dvector *xh, psb_c_dvector *bh, psb_c_dvector *rh)
{ {
psb_i_t iam, np; psb_c_i_t iam, np;
psb_l_t ix, iy, iz, el, glob_row; psb_c_l_t ix, iy, iz, el, glob_row;
psb_i_t i, k, info, ret; psb_c_i_t i, k, info, ret;
double x, y, z, deltah, sqdeltah, deltah2; double x, y, z, deltah, sqdeltah, deltah2;
double val[10 * NBMAX], zt[NBMAX]; double val[10 * NBMAX], zt[NBMAX];
psb_l_t irow[10 * NBMAX], icol[10 * NBMAX]; psb_c_l_t irow[10 * NBMAX], icol[10 * NBMAX];
info = 0; info = 0;
psb_c_info(cctxt, &iam, &np); psb_c_info(cctxt, &iam, &np);
@ -360,15 +360,15 @@ void get_hparm(FILE *fp, char *val)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
psb_c_ctxt *cctxt; psb_c_ctxt *cctxt;
psb_i_t iam, np; psb_c_i_t iam, np;
char methd[40], ptype[40], afmt[8], cdfmt[8]; char methd[40], ptype[40], afmt[8], cdfmt[8];
psb_i_t nparms; psb_c_i_t nparms;
psb_i_t idim, info, istop, itmax, itrace, irst, iter, ret; psb_c_i_t idim, info, istop, itmax, itrace, irst, iter, ret;
amg_c_dprec *ph; amg_c_dprec *ph;
psb_c_dspmat *ah; psb_c_dspmat *ah;
psb_c_dvector *bh, *xh, *rh; psb_c_dvector *bh, *xh, *rh;
psb_i_t nb, nlr, nl; psb_c_i_t nb, nlr, nl;
psb_l_t i, ng, *vl, k; psb_c_l_t i, ng, *vl, k;
double t1, t2, eps, err; double t1, t2, eps, err;
double *xv, *bv, *rv; double *xv, *bv, *rv;
double one = 1.0, zero = 0.0, res2; double one = 1.0, zero = 0.0, res2;
@ -439,18 +439,18 @@ int main(int argc, char *argv[])
psb_c_set_index_base(0); psb_c_set_index_base(0);
/* Simple minded BLOCK data distribution */ /* Simple minded BLOCK data distribution */
ng = ((psb_l_t)idim) * idim * idim; ng = ((psb_c_l_t)idim) * idim * idim;
nb = (ng + np - 1) / np; nb = (ng + np - 1) / np;
nl = nb; nl = nb;
if ((ng - iam * nb) < nl) if ((ng - iam * nb) < nl)
nl = ng - iam * nb; nl = ng - iam * nb;
fprintf(stderr, "%d: Input data %d %ld %d %d\n", iam, idim, ng, nb, nl); fprintf(stderr, "%d: Input data %d %ld %d %d\n", iam, idim, ng, nb, nl);
if ((vl = malloc(nb * sizeof(psb_l_t))) == NULL) if ((vl = malloc(nb * sizeof(psb_c_l_t))) == NULL)
{ {
fprintf(stderr, "On %d: malloc failure\n", iam); fprintf(stderr, "On %d: malloc failure\n", iam);
psb_c_abort(*cctxt); psb_c_abort(*cctxt);
} }
i = ((psb_l_t)iam) * nb; i = ((psb_c_l_t)iam) * nb;
for (k = 0; k < nl; k++) for (k = 0; k < nl; k++)
vl[k] = i + k; vl[k] = i + k;

Loading…
Cancel
Save