time_zlange_tile.c 2.35 KB
Newer Older
1
/**
2 3
 *
 * @file time_zlange_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.
7 8
 * @copyright 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
 *                      Univ. Bordeaux. All rights reserved.
9
 *
10
 ***
11
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
12
 * @version 1.0.0
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 * @precisions normal z -> c d s
 *
 **/
#define _TYPE  MORSE_Complex64_t
#define _PREC  double
#define _LAMCH LAPACKE_dlamch_work

#define _NAME  "MORSE_zlange_Tile"
/* See Lawn 41 page 120 */
#define _FMULS FMULS_LANGE(M, N)
#define _FADDS FADDS_LANGE(M, N)

#include "./timing.c"

static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
{
    double normmorse, normlapack, result;
31
    int    norm = MorseInfNorm;
32

33
    PASTE_CODE_IPARAM_LOCALS( iparam );
34 35 36 37 38 39 40

    /* Allocate Data */
    PASTE_CODE_ALLOCATE_MATRIX_TILE( descA, 1,     MORSE_Complex64_t, MorseComplexDouble, LDA, M, N    );
    MORSE_zplrnt_Tile( descA, 3436 );

    /* MORSE ZPOSV */
    START_TIMING();
41
    normmorse = MORSE_zlange_Tile(norm, descA);
42 43
    STOP_TIMING();

44
#if !defined(CHAMELEON_SIMULATION)
45 46 47 48 49
    /* Check the solution */
    if ( check )
    {
        /* Allocate Data */
        PASTE_TILE_TO_LAPACK( descA, A, check, MORSE_Complex64_t, M, N );
50
        double *work = (double*) malloc(chameleon_max(M,N)*sizeof(double));
51
        normlapack = LAPACKE_zlange_work(LAPACK_COL_MAJOR, morse_lapack_const(norm), M, N, A, LDA, work);
52
        result = fabs(normmorse - normlapack);
53
        switch(norm) {
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
        case MorseMaxNorm:
            /* result should be perfectly equal */
            break;
        case MorseInfNorm:
            /* Sum order on the line can differ */
            result = result / (double)N;
            break;
        case MorseOneNorm:
            /* Sum order on the column can differ */
            result = result / (double)M;
            break;
        case MorseFrobeniusNorm:
            /* Sum oreder on every element can differ */
            result = result / ((double)M * (double)N);
            break;
        }
        if ( MORSE_My_Mpi_Rank() == 0 ) {
            dparam[IPARAM_ANORM] = normlapack;
            dparam[IPARAM_BNORM] = 0.;
            dparam[IPARAM_XNORM] = 1.;
            dparam[IPARAM_RES] = result;
        }
        free( work );
        free( A );
    }
79
#endif
80 81 82 83
    PASTE_CODE_FREE_MATRIX( descA );

    return 0;
}