/**
 *
 * @generated s Thu Nov  8 11:44:50 2012
 *
 **/
#define _TYPE  float
#define _PREC  float
#define _LAMCH LAPACKE_slamch_work

#define _NAME  "PLASMA_ssyev_Tile"
/* See Lawn 41 page 120 */
#define _FMULS ((2. / 3.) * ((float)N * (float)N * (float)N))
#define _FADDS ((2. / 3.) * ((float)N * (float)N * (float)N))

#include "./timing.c"

static int
RunTest(int *iparam, float *dparam, real_Double_t *t_) 
{
    PASTE_CODE_IPARAM_LOCALS( iparam );
    PLASMA_desc *descT;
    int jobu  = PlasmaNoVec;
    int jobvt = PlasmaNoVec;

    /* Allocate Data */
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descA, 1, float, PlasmaRealFloat, LDA, N, N );
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descU, (jobu == PlasmaVec), float, PlasmaRealFloat, LDA, N, N );
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descVT, (jobvt == PlasmaVec), float, PlasmaRealFloat, LDA, N, N );
    PASTE_CODE_ALLOCATE_MATRIX( S, 1, float, N, 1 );

    /* Initialiaze Data */
    PLASMA_splrnt_Tile(descA, 51 );

    /* Save AT and bT in lapack layout for check */
    if ( check ) {
    }

    /* Allocate Workspace */
    PLASMA_Alloc_Workspace_sgesvd(N, N, &descT);

    START_TIMING();
    PLASMA_sgesvd_Tile(jobu, jobvt, descA, S, descU, descVT, descT);
    STOP_TIMING();
    
    /* Check the solution */
    if ( check )
      {
      }

    /* DeAllocate Workspace */
    PLASMA_Dealloc_Handle_Tile(&descT);

    if (jobu == PlasmaVec) {
      PASTE_CODE_FREE_MATRIX( descU );
    }
    if (jobvt == PlasmaVec) {
      PASTE_CODE_FREE_MATRIX( descVT );
    }
    PASTE_CODE_FREE_MATRIX( descA );
    free( S );

    return 0;
}
