time_zgesv_nopiv.c 1.91 KB
Newer Older
1
/**
2 3
 *
 * @file time_zgesv_nopiv.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.
Mathieu Faverge's avatar
Mathieu Faverge committed
7
 * @copyright 2012-2018 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8
 *                      Univ. Bordeaux. All rights reserved.
9
 *
10
 ***
11
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
12
 * @version 1.0.0
13 14
 * @precisions normal z -> c d s
 *
15
 */
16
#define _TYPE  CHAMELEON_Complex64_t
17 18 19
#define _PREC  double
#define _LAMCH LAPACKE_dlamch_work

20
#define _NAME  "CHAMELEON_zgesv_nopiv"
21 22 23 24 25
/* See Lawn 41 page 120 */
#define _FMULS (FMULS_GETRF( N, N ) + FMULS_GETRS( N, NRHS ))
#define _FADDS (FADDS_GETRF( N, N ) + FADDS_GETRS( N, NRHS ))

#include "./timing.c"
26
#include "timing_zauxiliary.h"
27 28

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

33 34 35 36
    if ( M != N ) {
        fprintf(stderr, "This timing works only with M == N\n");
        return -1;
    }
Mathieu Faverge's avatar
Mathieu Faverge committed
37

38
    /* Allocate Data */
39 40
    PASTE_CODE_ALLOCATE_MATRIX( A, 1, CHAMELEON_Complex64_t, LDA, N    );
    PASTE_CODE_ALLOCATE_MATRIX( X, 1, CHAMELEON_Complex64_t, LDB, NRHS );
Mathieu Faverge's avatar
Mathieu Faverge committed
41

42
    /* Initialize Data */
43 44
    CHAMELEON_zplrnt( N, N,    A, LDA,   51 );
    CHAMELEON_zplrnt( N, NRHS, X, LDB, 5673 );
45 46

    /* Save A and b  */
47 48
    PASTE_CODE_ALLOCATE_COPY( Acpy, check, CHAMELEON_Complex64_t, A, LDA, N    );
    PASTE_CODE_ALLOCATE_COPY( B,    check, CHAMELEON_Complex64_t, X, LDB, NRHS );
49 50

    START_TIMING();
51
    CHAMELEON_zgesv_nopiv( N, NRHS, A, N, X, LDB );
52
    STOP_TIMING();
Mathieu Faverge's avatar
Mathieu Faverge committed
53

54 55 56 57
    /* Check the solution */
    if (check)
    {
        dparam[IPARAM_RES] = z_check_solution(N, N, NRHS, Acpy, LDA, B, X, LDB,
Mathieu Faverge's avatar
Mathieu Faverge committed
58 59
                                              &(dparam[IPARAM_ANORM]),
                                              &(dparam[IPARAM_BNORM]),
60 61 62 63 64 65 66 67 68 69
                                              &(dparam[IPARAM_XNORM]));
        free(Acpy); free(B);
    }

    free( X );
    free( A );


    return 0;
}