/*******************************************************************************
 *  This file is AUTOMATICALLY GENERATED by:
 *  ../tools/fortran_wrappers.pl ../include/magma_ds.i
 *  Do not edit.
 ******************************************************************************/

#include <stdint.h>  // for uintptr_t

#include "magma_v2.h"
#include "magma_mangling.h"

/*
 * typedef comming from fortran.h file provided in CUDADIR/src directory
 * it will probably change with future release of CUDA when they use 64 bit addresses
 */
typedef size_t devptr_t;

#ifdef PGI_FORTRAN
    #define magma_idevptr(ptr_) ((magma_int_t*)       (ptr_))
    #define magma_zdevptr(ptr_) ((magmaDoubleComplex*)(ptr_))
    #define magma_cdevptr(ptr_) ((magmaFloatComplex*) (ptr_))
    #define magma_ddevptr(ptr_) ((double*)            (ptr_))
    #define magma_sdevptr(ptr_) ((float*)             (ptr_))
#else
    #define magma_idevptr(ptr_) ((magma_int_t*)       (uintptr_t)(*(ptr_)))
    #define magma_zdevptr(ptr_) ((magmaDoubleComplex*)(uintptr_t)(*(ptr_)))
    #define magma_cdevptr(ptr_) ((magmaFloatComplex*) (uintptr_t)(*(ptr_)))
    #define magma_ddevptr(ptr_) ((double*)            (uintptr_t)(*(ptr_)))
    #define magma_sdevptr(ptr_) ((float*)             (uintptr_t)(*(ptr_)))
#endif

#ifdef __cplusplus
extern "C" {
#endif

#define magmaf_dsgesv_gpu FORTRAN_NAME( magmaf_dsgesv_gpu, MAGMAF_DSGESV_GPU )
void magmaf_dsgesv_gpu(
    const char* trans, magma_int_t *n, magma_int_t *nrhs,
    devptr_t *dA, magma_int_t *ldda,
    magma_int_t *ipiv,
    devptr_t *dipiv,
    devptr_t *dB, magma_int_t *lddb,
    devptr_t *dX, magma_int_t *lddx,
    devptr_t *dworkd,
    devptr_t *dworks,
    magma_int_t *iter,
    magma_int_t *info )
{
    magma_dsgesv_gpu(
        magma_trans_const(*trans), *n, *nrhs,
        magma_ddevptr(dA), *ldda,
        ipiv,
        magma_idevptr(dipiv),
        magma_ddevptr(dB), *lddb,
        magma_ddevptr(dX), *lddx,
        magma_ddevptr(dworkd),
        magma_sdevptr(dworks),
        iter,
        info );
}

#define magmaf_dsgetrs_gpu FORTRAN_NAME( magmaf_dsgetrs_gpu, MAGMAF_DSGETRS_GPU )
void magmaf_dsgetrs_gpu(
    const char* trans, magma_int_t *n, magma_int_t *nrhs,
    devptr_t *dA, magma_int_t *ldda,
    devptr_t *dipiv,
    devptr_t *dB, magma_int_t *lddb,
    devptr_t *dX, magma_int_t *lddx,
    devptr_t *dSX,
    magma_int_t *info )
{
    magma_dsgetrs_gpu(
        magma_trans_const(*trans), *n, *nrhs,
        magma_sdevptr(dA), *ldda,
        magma_idevptr(dipiv),
        magma_ddevptr(dB), *lddb,
        magma_ddevptr(dX), *lddx,
        magma_sdevptr(dSX),
        info );
}

#define magmaf_dsposv_gpu FORTRAN_NAME( magmaf_dsposv_gpu, MAGMAF_DSPOSV_GPU )
void magmaf_dsposv_gpu(
    const char* uplo, magma_int_t *n, magma_int_t *nrhs,
    devptr_t *dA, magma_int_t *ldda,
    devptr_t *dB, magma_int_t *lddb,
    devptr_t *dX, magma_int_t *lddx,
    devptr_t *dworkd,
    devptr_t *dworks,
    magma_int_t *iter,
    magma_int_t *info )
{
    magma_dsposv_gpu(
        magma_uplo_const(*uplo), *n, *nrhs,
        magma_ddevptr(dA), *ldda,
        magma_ddevptr(dB), *lddb,
        magma_ddevptr(dX), *lddx,
        magma_ddevptr(dworkd),
        magma_sdevptr(dworks),
        iter,
        info );
}

#define magmaf_dsgeqrsv_gpu FORTRAN_NAME( magmaf_dsgeqrsv_gpu, MAGMAF_DSGEQRSV_GPU )
void magmaf_dsgeqrsv_gpu(
    magma_int_t *m, magma_int_t *n, magma_int_t *nrhs,
    devptr_t *dA, magma_int_t *ldda,
    devptr_t *dB, magma_int_t *lddb,
    devptr_t *dX, magma_int_t *lddx,
    magma_int_t *iter,
    magma_int_t *info )
{
    magma_dsgeqrsv_gpu(
        *m, *n, *nrhs,
        magma_ddevptr(dA), *ldda,
        magma_ddevptr(dB), *lddb,
        magma_ddevptr(dX), *lddx,
        iter,
        info );
}


#ifdef __cplusplus
}
#endif
