Actual source code: cholmodimpl.h

  1: #if !defined(CHOLMODIMPL_H_)
  2: #define CHOLMODIMPL_H_

  4: #include <petscsys.h>

  6: #if defined(PETSC_USE_COMPLEX)
  7: #  define CHOLMOD_SCALAR_TYPE       CHOLMOD_COMPLEX
  8: #else
  9: #  define CHOLMOD_SCALAR_TYPE       CHOLMOD_REAL
 10: #endif

 12: #if defined(PETSC_USE_64BIT_INDICES)
 13: #  define CHOLMOD_INT_TYPE                CHOLMOD_LONG
 14: #  define cholmod_X_start                 cholmod_l_start
 15: #  define cholmod_X_analyze               cholmod_l_analyze
 16: /* the type casts are needed because PetscInt is long long while SuiteSparse_long is long and compilers warn even when they are identical */
 17: #  define cholmod_X_analyze_p(a,b,c,d,f)  cholmod_l_analyze_p(a,(SuiteSparse_long *)b,(SuiteSparse_long *)c,d,f)
 18: #  define cholmod_X_copy                  cholmod_l_copy
 19: #  define cholmod_X_factorize             cholmod_l_factorize
 20: #  define cholmod_X_finish                cholmod_l_finish
 21: #  define cholmod_X_free_factor           cholmod_l_free_factor
 22: #  define cholmod_X_free_dense            cholmod_l_free_dense
 23: #  define cholmod_X_resymbol(a,b,c,d,f,e) cholmod_l_resymbol(a,(SuiteSparse_long *)b,c,d,f,e)
 24: #  define cholmod_X_solve                 cholmod_l_solve
 25: #  define cholmod_X_solve2                cholmod_l_solve2
 26: #  define cholmod_X_check_sparse          cholmod_l_check_sparse
 27: #else
 28: #  define CHOLMOD_INT_TYPE          CHOLMOD_INT
 29: #  define cholmod_X_start           cholmod_start
 30: #  define cholmod_X_analyze         cholmod_analyze
 31: #  define cholmod_X_analyze_p       cholmod_analyze_p
 32: #  define cholmod_X_copy            cholmod_copy
 33: #  define cholmod_X_factorize       cholmod_factorize
 34: #  define cholmod_X_finish          cholmod_finish
 35: #  define cholmod_X_free_factor     cholmod_free_factor
 36: #  define cholmod_X_free_dense      cholmod_free_dense
 37: #  define cholmod_X_resymbol        cholmod_resymbol
 38: #  define cholmod_X_solve           cholmod_solve
 39: #  define cholmod_X_solve2          cholmod_solve2
 40: #  define cholmod_X_check_sparse    cholmod_check_sparse
 41: #endif

 43: EXTERN_C_BEGIN
 44: #include <cholmod.h>
 45: #include <SuiteSparseQR_C.h>
 46: EXTERN_C_END

 48: typedef struct {
 49:   PetscErrorCode               (*Wrap)(Mat,PetscBool,cholmod_sparse*,PetscBool*,PetscBool*);
 50:   cholmod_sparse               *matrix;
 51:   cholmod_factor               *factor;
 52:   cholmod_common               *common;
 53:   SuiteSparseQR_C_factorization *spqrfact;
 54:   PetscBool                    pack;
 55:   PetscBool                    normal;
 56: } Mat_CHOLMOD;

 58: PETSC_INTERN PetscErrorCode CholmodStart(Mat);
 59: PETSC_INTERN PetscErrorCode MatView_CHOLMOD(Mat,PetscViewer);
 60: PETSC_INTERN PetscErrorCode MatCholeskyFactorSymbolic_CHOLMOD(Mat,Mat,IS,const MatFactorInfo*);
 61: PETSC_INTERN PetscErrorCode MatGetInfo_CHOLMOD(Mat,MatInfoType,MatInfo*);
 62: PETSC_INTERN PetscErrorCode MatDestroy_CHOLMOD(Mat);

 64: PETSC_INTERN PetscErrorCode VecWrapCholmod(Vec, PetscInt, cholmod_dense *);
 65: PETSC_INTERN PetscErrorCode VecUnWrapCholmod(Vec, PetscInt, cholmod_dense *);
 66: PETSC_INTERN PetscErrorCode MatDenseWrapCholmod(Mat, PetscInt, cholmod_dense *);
 67: PETSC_INTERN PetscErrorCode MatDenseUnWrapCholmod(Mat, PetscInt, cholmod_dense *);
 68: #endif /* CHOLMODIMPL_H_ */