time_zgelqf_tile.c 2.59 KB
Newer Older
1
/**
2 3
 *
 * @file time_zgelqf_tile.c
4
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
5 6
 * @copyright 2009-2014 The University of Tennessee and The University of
 *                      Tennessee Research Foundation. All rights reserved.
PRUVOST Florent's avatar
PRUVOST Florent committed
7
 * @copyright 2012-2019 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8
 *                      Univ. Bordeaux. All rights reserved.
9
 *
10
 ***
11
 *
PRUVOST Florent's avatar
PRUVOST Florent committed
12 13 14
 * @version 0.9.2
 * @author Mathieu Faverge
 * @date 2016-04-13
15 16
 * @precisions normal z -> c d s
 *
17
 */
18
#define _TYPE  CHAMELEON_Complex64_t
19 20 21
#define _PREC  double
#define _LAMCH LAPACKE_dlamch_work

22
#define _NAME  "CHAMELEON_zgelqf_Tile"
23 24 25 26 27 28 29
/* See Lawn 41 page 120 */
#define _FMULS FMULS_GELQF( M, N )
#define _FADDS FADDS_GELQF( M, N )

#include "./timing.c"

static int
Mathieu Faverge's avatar
Mathieu Faverge committed
30
RunTest(int *iparam, double *dparam, chameleon_time_t *t_)
31
{
32
    CHAM_desc_t *descT;
33 34 35
    PASTE_CODE_IPARAM_LOCALS( iparam );

    /* Allocate Data */
36 37 38 39
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descA,  1, CHAMELEON_Complex64_t, ChamComplexDouble, LDA, M, N );
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descX,  ( check && M == N ), CHAMELEON_Complex64_t, ChamComplexDouble, LDB, M, NRHS );
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descAC, ( check && M == N ), CHAMELEON_Complex64_t, ChamComplexDouble, LDA, M, N    );
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descB,  ( check && M == N ), CHAMELEON_Complex64_t, ChamComplexDouble, LDB, M, NRHS );
40

41
    CHAMELEON_zplrnt_Tile( descA, 5373 );
42 43 44

    /* Save A for check */
    if (check == 1 && M == N){
45
        CHAMELEON_zlacpy_Tile(ChamUpperLower, descA, descAC);
46 47 48
    }

    /* Allocate Workspace */
49
    CHAMELEON_Alloc_Workspace_zgels_Tile(M, N, &descT, P, Q);
50

51
    /* CHAMELEON ZGEQRF */
52
    START_TIMING();
53
    CHAMELEON_zgelqf_Tile( descA, descT );
54 55 56 57 58 59
    STOP_TIMING();

    /* Check the solution */
    if ( check && M == N )
    {
        /* Initialize and save B */
60 61
        CHAMELEON_zplrnt_Tile( descX, 2264 );
        CHAMELEON_zlacpy_Tile(ChamUpperLower, descX, descB);
62 63

        /* Compute the solution */
64
        CHAMELEON_zgelqs_Tile( descA, descT, descX );
65 66

        /* Check solution */
67 68 69 70 71
        dparam[IPARAM_ANORM] = CHAMELEON_zlange_Tile(ChamInfNorm, descAC);
        dparam[IPARAM_BNORM] = CHAMELEON_zlange_Tile(ChamInfNorm, descB);
        dparam[IPARAM_XNORM] = CHAMELEON_zlange_Tile(ChamInfNorm, descX);
        CHAMELEON_zgemm_Tile( ChamNoTrans, ChamNoTrans, 1.0, descAC, descX, -1.0, descB );
        dparam[IPARAM_RES] = CHAMELEON_zlange_Tile(ChamInfNorm, descB);
72 73 74 75 76 77
        PASTE_CODE_FREE_MATRIX( descX  )
        PASTE_CODE_FREE_MATRIX( descAC )
        PASTE_CODE_FREE_MATRIX( descB  )
    }

    /* Free data */
78
    CHAMELEON_Dealloc_Workspace(&descT);
79 80 81 82
    PASTE_CODE_FREE_MATRIX( descA )

    return 0;
}