/*
 *   -- clMAGMA (version 0.1) --
 *      Univ. of Tennessee, Knoxville
 *      Univ. of California, Berkeley
 *      Univ. of Colorado, Denver
 *      April 2012
 *
 * @author Mark Gates
 * @generated s Fri Nov 22 14:21:02 2013
 */

#ifndef MAGMA_S_H
#define MAGMA_S_H

#include "magma_types.h"

#define PRECISION_s

#ifdef __cplusplus
extern "C" {
#endif

/* ////////////////////////////////////////////////////////////////////////////
   -- MAGMA function definitions / Data on CPU
*/
magma_err_t
magma_sgetrf(magma_int_t m, magma_int_t n,
             float *a, magma_int_t lda,
             magma_int_t *ipiv, magma_int_t *info,
             magma_queue_t queue );
magma_err_t
magma_sgetrf3(magma_int_t m, magma_int_t n,
             float *a, magma_int_t lda, float *da, magma_int_t ldda,
             magma_int_t *ipiv, magma_int_t *d_ipiv, magma_int_t *info,
             magma_queue_t queue );


magma_err_t
magma_spotrf(
        magma_int_t uplo,
        magma_int_t n, 
        magmaFloat_ptr hA, magma_int_t lda, 
        magma_int_t *info, magma_queue_t queue);

magma_err_t
magma_spotrf3(
        magma_int_t uplo,
        magma_int_t n, 
        magmaFloat_ptr hA, magma_int_t lda, magmaFloat_ptr dA, magma_int_t ldda,
        magma_int_t *info, magma_queue_t queue);

magma_err_t
magma_sgeqrf(magma_int_t m, magma_int_t n,
             float *hA, magma_int_t lda, 
	     float *tau, float *hwork,
             magma_int_t lwork, magma_int_t *info,
             magma_queue_t queue );

magma_err_t
magma_sgeqrf3(magma_int_t m, magma_int_t n,
             float *hA, magma_int_t lda, float *dA, magma_int_t ldda, 
	     float *tau, float *hwork,
             magma_int_t lwork, magma_int_t *info,
             magma_queue_t queue );

magma_err_t
magma_sgetrf2(magma_int_t m, magma_int_t n,
              float *a, magma_int_t lda,
              magma_int_t *ipiv, 
              magmaFloat_ptr dA, magma_int_t ldda, magma_int_t *d_ipiv,
              magma_int_t *info, magma_queue_t queue );

magma_err_t
magma_sormtr( magma_side_t side, magma_uplo_t uplo, magma_trans_t trans,
              magma_int_t m, magma_int_t n,
              float *a,    magma_int_t lda,
              float *tau,
              float *c,    magma_int_t ldc,
              float *work, magma_int_t lwork,
              magma_int_t *info, magma_queue_t queue );

#if defined(PRECISION_z) || defined(PRECISION_c)
magma_err_t  
magma_sgeev(  magma_job_t jobvl, magma_job_t jobvr, magma_int_t n,
              float *a, magma_int_t lda,
              float *w,
              float *vl, magma_int_t ldvl,
              float *vr, magma_int_t ldvr,
              float *work, magma_int_t lwork,
              float *rwork, magma_int_t *info, magma_queue_t queue);

magma_err_t 
magma_sgesvd( magma_job_t jobu, magma_job_t jobvt, magma_int_t m, magma_int_t n,
              float *a,    magma_int_t lda, float *s,
              float *u,    magma_int_t ldu,
              float *vt,   magma_int_t ldvt,
              float *work, magma_int_t lwork,
              float *rwork, magma_int_t *info, magma_queue_t queue );

magma_err_t 
magma_ssyevd( magma_job_t jobz, magma_uplo_t uplo, magma_int_t n,
              float *a, magma_int_t lda, float *w,
              float *work, magma_int_t lwork,
              float *rwork, magma_int_t lrwork,
              magma_int_t *iwork, magma_int_t liwork, magma_int_t *info,
              magma_queue_t queue );

magma_err_t 
magma_sstedx( char range, magma_int_t n, float vl, float vu,
              magma_int_t il, magma_int_t iu, float *D, float *E,
              float *Z, magma_int_t ldz,
              float *rwork, magma_int_t ldrwork, magma_int_t *iwork,
              magma_int_t liwork, float *dwork, magma_int_t *info,
              magma_queue_t queue );

#else /* not (defined(PRECISION_z) || defined(PRECISION_c)) */

magma_err_t  
magma_sgeev(  magma_job_t jobvl, magma_job_t jobvr, magma_int_t n,
              float *a,    magma_int_t lda,
              float *wr, float *wi,
              float *vl,   magma_int_t ldvl,
              float *vr,   magma_int_t ldvr,
              float *work, magma_int_t lwork,
              magma_int_t *info, magma_queue_t queue);

magma_err_t 
magma_sgesvd( magma_job_t jobu, magma_job_t jobvt, magma_int_t m, magma_int_t n,
              float *a,    magma_int_t lda, float *s,
              float *u,    magma_int_t ldu,
              float *vt,   magma_int_t ldvt,
              float *work, magma_int_t lwork,
              magma_int_t *info, magma_queue_t queue );

magma_err_t 
magma_ssyevd( magma_job_t jobz, magma_uplo_t uplo, magma_int_t n,
              float *a, magma_int_t lda, float *w,
              float *work, magma_int_t lwork,
              magma_int_t *iwork, magma_int_t liwork, magma_int_t *info, 
              magma_queue_t queue);

magma_err_t 
magma_sstedx( char range, magma_int_t n, float vl, float vu,
              magma_int_t il, magma_int_t iu, float *d, float *e,
              float *z, magma_int_t ldz,
              float *work, magma_int_t lwork,
              magma_int_t *iwork, magma_int_t liwork,
              float *dwork, magma_int_t *info, magma_queue_t queue);

magma_err_t 
magma_slaex0( magma_int_t n, float *d, float *e, float *q, magma_int_t ldq,
              float *work, magma_int_t *iwork, float *dwork,
              char range, float vl, float vu,
              magma_int_t il, magma_int_t iu, magma_int_t *info,
              magma_queue_t queue);

magma_err_t 
magma_slaex1( magma_int_t n, float *d, float *q, magma_int_t ldq,
              magma_int_t *indxq, float rho, magma_int_t cutpnt,
              float *work, magma_int_t *iwork, float *dwork,
              char range, float vl, float vu,
              magma_int_t il, magma_int_t iu, magma_int_t *info,
              magma_queue_t queue);

magma_err_t 
magma_slaex3( magma_int_t k, magma_int_t n, magma_int_t n1, float *d,
              float *q, magma_int_t ldq, float rho,
              float *dlamda, float *q2, magma_int_t *indx,
              magma_int_t *ctot, float *w, float *s, magma_int_t *indxq,
              float *dwork,
              char range, float vl, float vu, magma_int_t il, magma_int_t iu,
              magma_int_t *info, magma_queue_t queue );

#endif /* not (defined(PRECISION_z) || defined(PRECISION_c)) */

/* //////////////////////////////////////////////////////////////////////////// 
 -- MAGMA function definitions / Data on MIC
*/

magma_err_t
magma_sgebrd(magma_int_t m, magma_int_t n,
             float *a, magma_int_t lda, float *d, float *e,
             float *tauq, float *taup,
             float *work, magma_int_t lwork,
             magma_int_t *info, magma_queue_t queue);

magma_err_t
magma_sgeqrf2_mic(
        magma_int_t m, magma_int_t n, 
        magmaFloat_ptr dA, size_t dA_offset, magma_int_t ldda, 
        float *tau, magma_int_t *info, magma_queue_t queue);

magma_err_t
magma_sgetrf_mic(
        magma_int_t m, magma_int_t n, 
        magmaFloat_ptr dA, size_t dA_offset, magma_int_t ldda, 
        magma_int_t *ipiv, magma_int_t *info, magma_queue_t queue);

magma_err_t
magma_sgetrf_mmic(
        magma_int_t num_mics, magma_int_t m, magma_int_t n, 
        magmaFloat_ptr *dA, magma_int_t ldda, 
        magma_int_t *ipiv, magma_int_t *info, magma_queue_t queue);

magma_err_t
magma_sgeqrf2_mmic(
        magma_int_t num_mics, magma_int_t m, magma_int_t n, 
        magmaFloat_ptr *dlA, magma_int_t ldda, 
        float *tau, magma_int_t *info, magma_queue_t queue);

magma_err_t
magma_slarfb_mic( 
        int side, int trans, int direct, int storev, 
        magma_int_t m, magma_int_t n, magma_int_t k,
        magmaFloat_ptr dV, size_t dV_offset, magma_int_t ldv,
        magmaFloat_ptr dT, size_t dT_offset, magma_int_t ldt, 
        magmaFloat_ptr dC, size_t dC_offset, magma_int_t ldc,
        magmaFloat_ptr dwork, size_t dwork_offset, magma_int_t ldwork,
        magma_queue_t queue);

magma_err_t
magma_slarfb_mic_gemm( 
        int side, int trans, int direct, int storev, 
        magma_int_t m, magma_int_t n, magma_int_t k,
        magmaFloat_ptr dV, size_t dV_offset, magma_int_t ldv,
        magmaFloat_ptr dT, size_t dT_offset, magma_int_t ldt, 
        magmaFloat_ptr dC, size_t dC_offset, magma_int_t ldc,
        magmaFloat_ptr dwork, size_t dwork_offset, magma_int_t ldwork,
        magmaFloat_ptr dworkvt, size_t dworkvt_offset, magma_int_t ldworkvt,
        magma_queue_t queue);

magma_err_t
magma_spotrf_mic(
        int uplo,
        magma_int_t n, 
        magmaFloat_ptr dA, size_t dA_offset, magma_int_t ldda, 
        magma_int_t *info, magma_queue_t queue);

magma_err_t
magma_spotrf_mmic(
        magma_int_t num_mics,
        int uplo,
        magma_int_t n, 
        magmaFloat_ptr *dA, magma_int_t ldda, 
        magma_int_t *info, magma_queue_t queue);

magma_err_t
magma_spotrs_mic(
         magma_uplo_t uplo, magma_int_t n, magma_int_t nrhs,
         magmaFloat_ptr dA, size_t dA_offset, magma_int_t ldda,
         magmaFloat_ptr dB, size_t dB_offset, magma_int_t lddb,
         magma_err_t *info, magma_queue_t queue );

magma_err_t
magma_sposv(
                magma_uplo_t uplo, magma_int_t n, magma_int_t nrhs,
                magmaFloat_ptr A, magma_int_t ldda,
                magmaFloat_ptr B, magma_int_t lddb,
                magma_err_t *info, magma_queue_t queue );

magma_err_t
magma_sposv_mic(
                magma_uplo_t uplo, magma_int_t n, magma_int_t nrhs,
                magmaFloat_ptr dA, size_t dA_offset, magma_int_t ldda,
                magmaFloat_ptr dB, size_t dB_offset, magma_int_t lddb,
                magma_err_t *info, magma_queue_t queue );

magma_int_t magma_sgetri_mic( magma_int_t n,
		float *dA, magma_int_t ldda, magma_int_t *ipiv,
		float *dwork, magma_int_t lwork, magma_int_t *info, magma_queue_t queue);

magma_int_t magma_strtri_mic( magma_uplo_t uplo,  magma_diag_t diag, magma_int_t n,
		float *dA, magma_int_t ldda, magma_int_t *info, magma_queue_t queue);
magma_err_t
magma_sgetrs_mic(magma_trans_t trans, magma_int_t n, magma_int_t nrhs,
                 magmaFloat_ptr dA, size_t dA_offset, magma_int_t ldda,
                 magma_int_t *ipiv,
                 magmaFloat_ptr dB, size_t dB_offset, magma_int_t lddb,
                 magma_int_t *info, magma_queue_t queue);
magma_int_t magma_sgesv ( magma_int_t n, magma_int_t nrhs,
		float *A, magma_int_t lda, magma_int_t *ipiv,
		float *B, magma_int_t ldb, magma_int_t *info, magma_queue_t queue);
magma_err_t
magma_sgesv_mic( magma_int_t n, magma_int_t nrhs,
                 magmaFloat_ptr dA, size_t dA_offset, magma_int_t ldda,
                 magma_int_t *ipiv,
                 magmaFloat_ptr dB, size_t dB_offset, magma_int_t lddb,
                 magma_err_t *info, magma_queue_t queue );

magma_int_t
magma_sormqr_mic(magma_side_t side, magma_trans_t trans,
                 magma_int_t m, magma_int_t n, magma_int_t k,
                 magmaFloat_ptr dA, size_t dA_offset, magma_int_t ldda,
                 float *tau,
                 magmaFloat_ptr dC, size_t dC_offset, magma_int_t lddc,
                 float *hwork, magma_int_t lwork,
                 magmaFloat_ptr dT, size_t dT_offset, magma_int_t nb,
                 magma_int_t *info, magma_queue_t queue);

magma_err_t
magma_sgeqrs_mic(magma_int_t m, magma_int_t n, magma_int_t nrhs,
                 magmaFloat_ptr dA, size_t dA_offset, magma_int_t ldda,
                 float *tau,   magmaFloat_ptr dT, size_t dT_offset,
                 magmaFloat_ptr dB, size_t dB_offset, magma_int_t lddb,
                 float *hwork, magma_int_t lwork,
                 magma_int_t *info, magma_queue_t queue);

magma_err_t
magma_sgeqrf_mic( magma_int_t m, magma_int_t n,
                  magmaFloat_ptr dA, size_t dA_offset,  magma_int_t ldda,
                  float *tau, magmaFloat_ptr dT, size_t dT_offset,
                  magma_int_t *info, magma_queue_t queue);

magma_int_t
magma_sgels_mic( magma_trans_t trans, magma_int_t m, magma_int_t n, magma_int_t nrhs,
                 magmaFloat_ptr dA, size_t dA_offset,  magma_int_t ldda,
                 magmaFloat_ptr dB, size_t dB_offset,  magma_int_t lddb,
                 float *hwork, magma_int_t lwork,
                 magma_int_t *info, magma_queue_t queue );

magma_int_t
magma_sgehrd(   magma_int_t n, magma_int_t ilo, magma_int_t ihi,
                float *a, magma_int_t lda,
                float *tau,
                float *work, magma_int_t lwork,
                magmaFloat_ptr dT, size_t dT_offset,
                magma_int_t *info, magma_queue_t queue );

magma_int_t
magma_slabrd_mic( magma_int_t m, magma_int_t n, magma_int_t nb,
                  float *a, magma_int_t lda,
                  magmaFloat_ptr da, size_t da_offset, magma_int_t ldda,
                  float *d, float *e, float *tauq, float *taup,
                  float *x, magma_int_t ldx,
                  magmaFloat_ptr dx, size_t dx_offset, magma_int_t lddx,
                  float *y, magma_int_t ldy,
                  magmaFloat_ptr dy, size_t dy_offset, magma_int_t lddy,
                  magma_queue_t queue );

magma_err_t
magma_slahr2(   magma_int_t n, magma_int_t k, magma_int_t nb,
                magmaFloat_ptr da, size_t da_offset, magmaFloat_ptr dv, size_t dv_offset,
                float *a, magma_int_t lda,
                float *tau, float *t, magma_int_t ldt,
                float *y, magma_int_t ldy,
                magma_queue_t queue     );

magma_err_t
magma_slahru(   magma_int_t n, magma_int_t ihi, magma_int_t k, magma_int_t nb,
                float *a, magma_int_t lda,
                magmaFloat_ptr d_a, size_t d_a_offset, magmaFloat_ptr y, size_t y_offset,
                magmaFloat_ptr v, size_t v_offset, magmaFloat_ptr d_t, size_t dt_offset,
                magmaFloat_ptr d_work, size_t d_work_offset, magma_queue_t queue );

magma_err_t
magma_sorghr(   magma_int_t n, magma_int_t ilo, magma_int_t ihi,
                float *a, magma_int_t lda,
                float *tau,
                magmaFloat_ptr dT, size_t dT_offset, magma_int_t nb,
                magma_int_t *info, magma_queue_t queue );

magma_err_t
magma_sorgqr(   magma_int_t m, magma_int_t n, magma_int_t k,
                float *a, magma_int_t lda,
                float *tau, magmaFloat_ptr dT, size_t dT_offset,
                magma_int_t nb, magma_int_t *info, magma_queue_t queue );

magma_err_t
magma_sorgqr2(  magma_int_t m, magma_int_t n, magma_int_t k,
                float *A, magma_int_t lda,
                float *tau,
                magma_int_t *info, magma_queue_t queue);

magma_err_t 
magma_sormql(   magma_side_t side, magma_trans_t trans,
                magma_int_t m, magma_int_t n, magma_int_t k,
                float *a, magma_int_t lda,
                float *tau,
                float *c, magma_int_t ldc,
                float *work, magma_int_t lwork,
                magma_int_t *info, magma_queue_t queue );

magma_err_t 
magma_sormqr(   magma_side_t side, magma_trans_t trans,
                magma_int_t m, magma_int_t n, magma_int_t k,
                float *a, magma_int_t lda, float *tau,
                float *c, magma_int_t ldc,
                float *work, magma_int_t lwork, 
                magma_int_t *info, magma_queue_t queue);

magma_err_t 
magma_sormtr(   magma_side_t side, magma_uplo_t uplo, magma_trans_t trans,
                magma_int_t m, magma_int_t n,
                float *a,    magma_int_t lda,
                float *tau,
                float *c,    magma_int_t ldc,
                float *work, magma_int_t lwork,
                magma_int_t *info, magma_queue_t queue);

magma_err_t
magma_slatrd(   magma_uplo_t uplo, magma_int_t n, magma_int_t nb,
                float *a,  magma_int_t lda,
                float *e, float *tau,
                float *w,  magma_int_t ldw,
                magmaFloat_ptr da, size_t da_offset, magma_int_t ldda,
                magmaFloat_ptr dw, size_t dw_offset, magma_int_t lddw, magma_queue_t queue);

magma_err_t
magma_ssytrd(  magma_uplo_t uplo, magma_int_t n,
               float *a, magma_int_t lda,
               float *d, float *e, float *tau,
               float *work, magma_int_t lwork,
               magma_int_t *info, magma_queue_t queue);

/* //////////////////////////////////////////////////////////////////////////// 
 -- MAGMA utility function definitions
*/

void magma_sprint    ( magma_int_t m, magma_int_t n, float     *A, magma_int_t lda  );
void magma_sprint_gpu( magma_int_t m, magma_int_t n, magmaFloat_ptr dA, magma_int_t ldda );

void spanel_to_q(magma_uplo_t uplo, int ib, float *A, int lda, float *work);
void sq_to_panel(magma_uplo_t uplo, int ib, float *A, int lda, float *work);

#ifdef __cplusplus
}
#endif

#undef PRECISION_s
#endif /* MAGMA_S_H */
