diff --git a/cbind/base/psb_base_cbind.h b/cbind/base/psb_base_cbind.h index 6e07e499..380208cb 100644 --- a/cbind/base/psb_base_cbind.h +++ b/cbind/base/psb_base_cbind.h @@ -2,6 +2,10 @@ #define PSB_BASE_CBIND_ #include "psb_c_base.h" +#include "psb_c_sbase.h" #include "psb_c_dbase.h" +#include "psb_c_cbase.h" +#include "psb_c_zbase.h" + #endif diff --git a/cbind/base/psb_c_cbase.h b/cbind/base/psb_c_cbase.h index 9eaaaaa9..ce9952f8 100644 --- a/cbind/base/psb_c_cbase.h +++ b/cbind/base/psb_c_cbase.h @@ -1,5 +1,5 @@ -#ifndef PSB_C_DBASE_ -#define PSB_C_DBASE_ +#ifndef PSB_C_CBASE_ +#define PSB_C_CBASE_ #include "psb_c_base.h" #ifdef __cplusplus @@ -22,40 +22,40 @@ psb_c_t *psb_c_cvect_get_cpy( psb_c_cvector *xh); psb_i_t psb_c_cvect_f_get_cpy(psb_c_t *v, psb_c_cvector *xh); psb_i_t psb_c_cvect_zero(psb_c_cvector *xh); -psb_i_t psb_c_dgeall(psb_c_cvector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgeins(psb_i_t nz, const psb_i_t *irw, const psb_c_t *val, +psb_i_t psb_c_cgeall(psb_c_cvector *xh, psb_c_descriptor *cdh); +psb_i_t psb_c_cgeins(psb_i_t nz, const psb_i_t *irw, const psb_c_t *val, psb_c_cvector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgeins_add(psb_i_t nz, const psb_i_t *irw, const psb_c_t *val, +psb_i_t psb_c_cgeins_add(psb_i_t nz, const psb_i_t *irw, const psb_c_t *val, psb_c_cvector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgeasb(psb_c_cvector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgefree(psb_c_cvector *xh, psb_c_descriptor *cdh); +psb_i_t psb_c_cgeasb(psb_c_cvector *xh, psb_c_descriptor *cdh); +psb_i_t psb_c_cgefree(psb_c_cvector *xh, psb_c_descriptor *cdh); /* sparse matrices*/ psb_c_cspmat* psb_c_new_cspmat(); -psb_i_t psb_c_dspall(psb_c_cspmat *mh, psb_c_descriptor *cdh); -psb_i_t psb_c_dspasb(psb_c_cspmat *mh, psb_c_descriptor *cdh); -psb_i_t psb_c_dspfree(psb_c_cspmat *mh, psb_c_descriptor *cdh); -psb_i_t psb_c_dspins(psb_i_t nz, const psb_i_t *irw, const psb_i_t *icl, const psb_c_t *val, +psb_i_t psb_c_cspall(psb_c_cspmat *mh, psb_c_descriptor *cdh); +psb_i_t psb_c_cspasb(psb_c_cspmat *mh, psb_c_descriptor *cdh); +psb_i_t psb_c_cspfree(psb_c_cspmat *mh, psb_c_descriptor *cdh); +psb_i_t psb_c_cspins(psb_i_t nz, const psb_i_t *irw, const psb_i_t *icl, const psb_c_t *val, psb_c_cspmat *mh, psb_c_descriptor *cdh); -psb_i_t psb_c_dmat_get_nrows(psb_c_cspmat *mh); -psb_i_t psb_c_dmat_get_ncols(psb_c_cspmat *mh); +psb_i_t psb_c_cmat_get_nrows(psb_c_cspmat *mh); +psb_i_t psb_c_cmat_get_ncols(psb_c_cspmat *mh); -/* psb_i_t psb_c_dspasb_opt(psb_c_cspmat *mh, psb_c_descriptor *cdh, */ +/* psb_i_t psb_c_cspasb_opt(psb_c_cspmat *mh, psb_c_descriptor *cdh, */ /* const char *afmt, psb_i_t upd, psb_i_t dupl); */ -psb_i_t psb_c_dsprn(psb_c_cspmat *mh, psb_c_descriptor *cdh, _Bool clear); -/* psb_i_t psb_c_dspprint(psb_c_cspmat *mh); */ +psb_i_t psb_c_csprn(psb_c_cspmat *mh, psb_c_descriptor *cdh, _Bool clear); +/* psb_i_t psb_c_cspprint(psb_c_cspmat *mh); */ /* psblas computational routines */ -psb_c_t psb_c_dgedot(psb_c_cvector *xh, psb_c_cvector *yh, psb_c_descriptor *cdh); -psb_s_t psb_c_dgenrm2(psb_c_cvector *xh, psb_c_descriptor *cdh); -psb_s_t psb_c_dgeamax(psb_c_cvector *xh, psb_c_descriptor *cdh); -psb_s_t psb_c_dgeasum(psb_c_cvector *xh, psb_c_descriptor *cdh); -psb_s_t psb_c_dspnrmi(psb_c_cvector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgeaxpby(psb_c_t alpha, psb_c_cvector *xh, +psb_c_t psb_c_cgedot(psb_c_cvector *xh, psb_c_cvector *yh, psb_c_descriptor *cdh); +psb_s_t psb_c_cgenrm2(psb_c_cvector *xh, psb_c_descriptor *cdh); +psb_s_t psb_c_cgeamax(psb_c_cvector *xh, psb_c_descriptor *cdh); +psb_s_t psb_c_cgeasum(psb_c_cvector *xh, psb_c_descriptor *cdh); +psb_s_t psb_c_cspnrmi(psb_c_cspmat *ah, psb_c_descriptor *cdh); +psb_i_t psb_c_cgeaxpby(psb_c_t alpha, psb_c_cvector *xh, psb_c_t beta, psb_c_cvector *yh, psb_c_descriptor *cdh); psb_i_t psb_c_cspmm(psb_c_t alpha, psb_c_cspmat *ah, psb_c_cvector *xh, psb_c_t beta, psb_c_cvector *yh, psb_c_descriptor *cdh); -psb_i_t psb_c_dspsm(psb_c_t alpha, psb_c_cspmat *th, psb_c_cvector *xh, +psb_i_t psb_c_cspsm(psb_c_t alpha, psb_c_cspmat *th, psb_c_cvector *xh, psb_c_t beta, psb_c_cvector *yh, psb_c_descriptor *cdh); #ifdef __cplusplus } diff --git a/cbind/base/psb_c_dcomm.c b/cbind/base/psb_c_dcomm.c new file mode 100644 index 00000000..6b31d18e --- /dev/null +++ b/cbind/base/psb_c_dcomm.c @@ -0,0 +1,39 @@ +#include +#include "psb_c_dbase.h" + +psb_c_dvector* psb_c_new_dvector() +{ + psb_c_dvector* temp; + + temp=(psb_c_dvector *) malloc(sizeof(psb_c_dvector)); + temp->dvector=NULL; + return(temp); +} + +psb_d_t* psb_c_dvect_get_cpy(psb_c_dvector *xh) +{ + psb_d_t *temp=NULL; + psb_i_t vsize=0; + + if ((vsize=psb_c_dvect_get_nrows(xh))<0) + return(temp); + + if (vsize==0) + vsize=1; + + if ((temp=(psb_d_t *)malloc(vsize*sizeof(psb_d_t)))!=NULL) + psb_c_dvect_f_get_cpy(temp,xh); + + return(temp); + +} + + +psb_c_dspmat* psb_c_new_dspmat() +{ + psb_c_dspmat* temp; + + temp=(psb_c_dspmat *) malloc(sizeof(psb_c_dspmat)); + temp->dspmat=NULL; + return(temp); +} diff --git a/cbind/base/psb_c_dcomm.h b/cbind/base/psb_c_dcomm.h new file mode 100644 index 00000000..0d5f6c4a --- /dev/null +++ b/cbind/base/psb_c_dcomm.h @@ -0,0 +1,18 @@ +#ifndef PSB_C_DCOMM_ +#define PSB_C_DCOMM_ +#include "psb_c_dbase.h" + +#ifdef __cplusplus +extern "C" { +#endif + + psb_i_t psb_c_dvscatter(psb_c_dvector *xh, psb_c_descriptor *cdh); + psb_d_t* psb_c_dvgather(psb_c_dvector *xh, psb_c_descriptor *cdh); + psb_c_dspmat* psb_c_dspgather(psb_c_dspmat *ah, psb_c_descriptor *cdh); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif diff --git a/cbind/base/psb_c_sbase.h b/cbind/base/psb_c_sbase.h index 6f08a50d..5d8132de 100644 --- a/cbind/base/psb_c_sbase.h +++ b/cbind/base/psb_c_sbase.h @@ -1,5 +1,5 @@ -#ifndef PSB_C_DBASE_ -#define PSB_C_DBASE_ +#ifndef PSB_C_SBASE_ +#define PSB_C_SBASE_ #include "psb_c_base.h" #ifdef __cplusplus @@ -22,40 +22,40 @@ psb_s_t *psb_c_svect_get_cpy( psb_c_svector *xh); psb_i_t psb_c_svect_f_get_cpy(psb_s_t *v, psb_c_svector *xh); psb_i_t psb_c_svect_zero(psb_c_svector *xh); -psb_i_t psb_c_dgeall(psb_c_svector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgeins(psb_i_t nz, const psb_i_t *irw, const psb_s_t *val, +psb_i_t psb_c_sgeall(psb_c_svector *xh, psb_c_descriptor *cdh); +psb_i_t psb_c_sgeins(psb_i_t nz, const psb_i_t *irw, const psb_s_t *val, psb_c_svector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgeins_add(psb_i_t nz, const psb_i_t *irw, const psb_s_t *val, +psb_i_t psb_c_sgeins_add(psb_i_t nz, const psb_i_t *irw, const psb_s_t *val, psb_c_svector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgeasb(psb_c_svector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgefree(psb_c_svector *xh, psb_c_descriptor *cdh); +psb_i_t psb_c_sgeasb(psb_c_svector *xh, psb_c_descriptor *cdh); +psb_i_t psb_c_sgefree(psb_c_svector *xh, psb_c_descriptor *cdh); /* sparse matrices*/ psb_c_sspmat* psb_c_new_sspmat(); -psb_i_t psb_c_dspall(psb_c_sspmat *mh, psb_c_descriptor *cdh); -psb_i_t psb_c_dspasb(psb_c_sspmat *mh, psb_c_descriptor *cdh); -psb_i_t psb_c_dspfree(psb_c_sspmat *mh, psb_c_descriptor *cdh); -psb_i_t psb_c_dspins(psb_i_t nz, const psb_i_t *irw, const psb_i_t *icl, const psb_s_t *val, +psb_i_t psb_c_sspall(psb_c_sspmat *mh, psb_c_descriptor *cdh); +psb_i_t psb_c_sspasb(psb_c_sspmat *mh, psb_c_descriptor *cdh); +psb_i_t psb_c_sspfree(psb_c_sspmat *mh, psb_c_descriptor *cdh); +psb_i_t psb_c_sspins(psb_i_t nz, const psb_i_t *irw, const psb_i_t *icl, const psb_s_t *val, psb_c_sspmat *mh, psb_c_descriptor *cdh); -psb_i_t psb_c_dmat_get_nrows(psb_c_sspmat *mh); -psb_i_t psb_c_dmat_get_ncols(psb_c_sspmat *mh); +psb_i_t psb_c_smat_get_nrows(psb_c_sspmat *mh); +psb_i_t psb_c_smat_get_ncols(psb_c_sspmat *mh); -/* psb_i_t psb_c_dspasb_opt(psb_c_sspmat *mh, psb_c_descriptor *cdh, */ +/* psb_i_t psb_c_sspasb_opt(psb_c_sspmat *mh, psb_c_descriptor *cdh, */ /* const char *afmt, psb_i_t upd, psb_i_t dupl); */ -psb_i_t psb_c_dsprn(psb_c_sspmat *mh, psb_c_descriptor *cdh, _Bool clear); -/* psb_i_t psb_c_dspprint(psb_c_sspmat *mh); */ +psb_i_t psb_c_ssprn(psb_c_sspmat *mh, psb_c_descriptor *cdh, _Bool clear); +/* psb_i_t psb_c_sspprint(psb_c_sspmat *mh); */ /* psblas computational routines */ -psb_s_t psb_c_dgedot(psb_c_svector *xh, psb_c_svector *yh, psb_c_descriptor *cdh); -psb_s_t psb_c_dgenrm2(psb_c_svector *xh, psb_c_descriptor *cdh); -psb_s_t psb_c_dgeamax(psb_c_svector *xh, psb_c_descriptor *cdh); -psb_s_t psb_c_dgeasum(psb_c_svector *xh, psb_c_descriptor *cdh); -psb_s_t psb_c_dspnrmi(psb_c_svector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgeaxpby(psb_s_t alpha, psb_c_svector *xh, +psb_s_t psb_c_sgedot(psb_c_svector *xh, psb_c_svector *yh, psb_c_descriptor *cdh); +psb_s_t psb_c_sgenrm2(psb_c_svector *xh, psb_c_descriptor *cdh); +psb_s_t psb_c_sgeamax(psb_c_svector *xh, psb_c_descriptor *cdh); +psb_s_t psb_c_sgeasum(psb_c_svector *xh, psb_c_descriptor *cdh); +psb_s_t psb_c_sspnrmi(psb_c_sspmat *ah, psb_c_descriptor *cdh); +psb_i_t psb_c_sgeaxpby(psb_s_t alpha, psb_c_svector *xh, psb_s_t beta, psb_c_svector *yh, psb_c_descriptor *cdh); psb_i_t psb_c_sspmm(psb_s_t alpha, psb_c_sspmat *ah, psb_c_svector *xh, psb_s_t beta, psb_c_svector *yh, psb_c_descriptor *cdh); -psb_i_t psb_c_dspsm(psb_s_t alpha, psb_c_sspmat *th, psb_c_svector *xh, +psb_i_t psb_c_sspsm(psb_s_t alpha, psb_c_sspmat *th, psb_c_svector *xh, psb_s_t beta, psb_c_svector *yh, psb_c_descriptor *cdh); #ifdef __cplusplus } diff --git a/cbind/base/psb_c_zbase.h b/cbind/base/psb_c_zbase.h index 7b7f24c4..540562d7 100644 --- a/cbind/base/psb_c_zbase.h +++ b/cbind/base/psb_c_zbase.h @@ -1,5 +1,5 @@ -#ifndef PSB_C_DBASE_ -#define PSB_C_DBASE_ +#ifndef PSB_C_ZBASE_ +#define PSB_C_ZBASE_ #include "psb_c_base.h" #ifdef __cplusplus @@ -22,40 +22,40 @@ psb_z_t *psb_c_zvect_get_cpy( psb_c_zvector *xh); psb_i_t psb_c_zvect_f_get_cpy(psb_z_t *v, psb_c_zvector *xh); psb_i_t psb_c_zvect_zero(psb_c_zvector *xh); -psb_i_t psb_c_dgeall(psb_c_zvector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgeins(psb_i_t nz, const psb_i_t *irw, const psb_z_t *val, +psb_i_t psb_c_zgeall(psb_c_zvector *xh, psb_c_descriptor *cdh); +psb_i_t psb_c_zgeins(psb_i_t nz, const psb_i_t *irw, const psb_z_t *val, psb_c_zvector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgeins_add(psb_i_t nz, const psb_i_t *irw, const psb_z_t *val, +psb_i_t psb_c_zgeins_add(psb_i_t nz, const psb_i_t *irw, const psb_z_t *val, psb_c_zvector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgeasb(psb_c_zvector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgefree(psb_c_zvector *xh, psb_c_descriptor *cdh); +psb_i_t psb_c_zgeasb(psb_c_zvector *xh, psb_c_descriptor *cdh); +psb_i_t psb_c_zgefree(psb_c_zvector *xh, psb_c_descriptor *cdh); /* sparse matrices*/ psb_c_zspmat* psb_c_new_zspmat(); -psb_i_t psb_c_dspall(psb_c_zspmat *mh, psb_c_descriptor *cdh); -psb_i_t psb_c_dspasb(psb_c_zspmat *mh, psb_c_descriptor *cdh); -psb_i_t psb_c_dspfree(psb_c_zspmat *mh, psb_c_descriptor *cdh); -psb_i_t psb_c_dspins(psb_i_t nz, const psb_i_t *irw, const psb_i_t *icl, const psb_z_t *val, +psb_i_t psb_c_zspall(psb_c_zspmat *mh, psb_c_descriptor *cdh); +psb_i_t psb_c_zspasb(psb_c_zspmat *mh, psb_c_descriptor *cdh); +psb_i_t psb_c_zspfree(psb_c_zspmat *mh, psb_c_descriptor *cdh); +psb_i_t psb_c_zspins(psb_i_t nz, const psb_i_t *irw, const psb_i_t *icl, const psb_z_t *val, psb_c_zspmat *mh, psb_c_descriptor *cdh); -psb_i_t psb_c_dmat_get_nrows(psb_c_zspmat *mh); -psb_i_t psb_c_dmat_get_ncols(psb_c_zspmat *mh); +psb_i_t psb_c_zmat_get_nrows(psb_c_zspmat *mh); +psb_i_t psb_c_zmat_get_ncols(psb_c_zspmat *mh); -/* psb_i_t psb_c_dspasb_opt(psb_c_zspmat *mh, psb_c_descriptor *cdh, */ +/* psb_i_t psb_c_zspasb_opt(psb_c_zspmat *mh, psb_c_descriptor *cdh, */ /* const char *afmt, psb_i_t upd, psb_i_t dupl); */ -psb_i_t psb_c_dsprn(psb_c_zspmat *mh, psb_c_descriptor *cdh, _Bool clear); -/* psb_i_t psb_c_dspprint(psb_c_zspmat *mh); */ +psb_i_t psb_c_zsprn(psb_c_zspmat *mh, psb_c_descriptor *cdh, _Bool clear); +/* psb_i_t psb_c_zspprint(psb_c_zspmat *mh); */ /* psblas computational routines */ -psb_z_t psb_c_dgedot(psb_c_zvector *xh, psb_c_zvector *yh, psb_c_descriptor *cdh); -psb_d_t psb_c_dgenrm2(psb_c_zvector *xh, psb_c_descriptor *cdh); -psb_d_t psb_c_dgeamax(psb_c_zvector *xh, psb_c_descriptor *cdh); -psb_d_t psb_c_dgeasum(psb_c_zvector *xh, psb_c_descriptor *cdh); -psb_d_t psb_c_dspnrmi(psb_c_zvector *xh, psb_c_descriptor *cdh); -psb_i_t psb_c_dgeaxpby(psb_z_t alpha, psb_c_zvector *xh, +psb_z_t psb_c_zgedot(psb_c_zvector *xh, psb_c_zvector *yh, psb_c_descriptor *cdh); +psb_d_t psb_c_zgenrm2(psb_c_zvector *xh, psb_c_descriptor *cdh); +psb_d_t psb_c_zgeamax(psb_c_zvector *xh, psb_c_descriptor *cdh); +psb_d_t psb_c_zgeasum(psb_c_zvector *xh, psb_c_descriptor *cdh); +psb_d_t psb_c_zspnrmi(psb_c_zspmat *ah, psb_c_descriptor *cdh); +psb_i_t psb_c_zgeaxpby(psb_z_t alpha, psb_c_zvector *xh, psb_z_t beta, psb_c_zvector *yh, psb_c_descriptor *cdh); psb_i_t psb_c_zspmm(psb_z_t alpha, psb_c_zspmat *ah, psb_c_zvector *xh, psb_z_t beta, psb_c_zvector *yh, psb_c_descriptor *cdh); -psb_i_t psb_c_dspsm(psb_z_t alpha, psb_c_zspmat *th, psb_c_zvector *xh, +psb_i_t psb_c_zspsm(psb_z_t alpha, psb_c_zspmat *th, psb_c_zvector *xh, psb_z_t beta, psb_c_zvector *yh, psb_c_descriptor *cdh); #ifdef __cplusplus }