time_zpotrf.c 2.1 KB
Newer Older
1
/**
2 3
 *
 * @file time_zpotrf.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
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
10
 ***
11
 *
PRUVOST Florent's avatar
PRUVOST Florent committed
12 13 14
 * @version 0.9.2
 * @author Mathieu Faverges
 * @date 2014-11-16
15 16
 * @precisions normal z -> c d s
 *
17
 */
Mathieu Faverge's avatar
Mathieu Faverge committed
18
#define _TYPE  CHAMELEON_Complex64_t
19 20 21
#define _PREC  double
#define _LAMCH LAPACKE_dlamch_work

Mathieu Faverge's avatar
Mathieu Faverge committed
22
#define _NAME  "CHAMELEON_zpotrf"
23 24 25 26 27
/* See Lawn 41 page 120 */
#define _FMULS FMULS_POTRF( N )
#define _FADDS FADDS_POTRF( N )

#include "./timing.c"
28
#include "timing_zauxiliary.h"
29 30

static int
Mathieu Faverge's avatar
Mathieu Faverge committed
31
RunTest(int *iparam, double *dparam, chameleon_time_t *t_)
32 33
{
    PASTE_CODE_IPARAM_LOCALS( iparam );
Mathieu Faverge's avatar
Mathieu Faverge committed
34
    cham_uplo_t uplo = ChamLower;
35

36
    LDA = chameleon_max( LDA, N );
37 38

    /* Allocate Data */
39 40
    PASTE_CODE_ALLOCATE_MATRIX( A,  1,     CHAMELEON_Complex64_t, LDA, N );
    PASTE_CODE_ALLOCATE_MATRIX( A2, check, CHAMELEON_Complex64_t, LDA, N );
41

42 43 44 45 46 47 48 49
    /* Initialize data and save A if check */
    if ( check ) {
        CHAMELEON_zplghe( (double)N, ChamUpperLower, N, A2, LDA, 51 );
        CHAMELEON_zlacpy( uplo, N, N, A2, LDA, A, LDA );
    }
    else {
        CHAMELEON_zplghe( (double)N, uplo, N, A, LDA, 51 );
    }
50

Mathieu Faverge's avatar
Mathieu Faverge committed
51
    /* CHAMELEON ZPOSV */
52
    START_TIMING();
53
    CHAMELEON_zpotrf( uplo, N, A, LDA );
54 55 56
    STOP_TIMING();

    /* Check the solution */
57 58
    if ( check )
    {
Mathieu Faverge's avatar
Mathieu Faverge committed
59 60 61
        PASTE_CODE_ALLOCATE_MATRIX( B, check, CHAMELEON_Complex64_t, LDB, NRHS );
        CHAMELEON_zplrnt( N, NRHS, B, LDB, 5673 );
        PASTE_CODE_ALLOCATE_COPY( X,  check, CHAMELEON_Complex64_t, B, LDB, NRHS );
62

Mathieu Faverge's avatar
Mathieu Faverge committed
63
        CHAMELEON_zpotrs(uplo, N, NRHS, A, LDA, X, LDB);
64

65 66 67 68
        dparam[IPARAM_RES] = z_check_solution( N, N, NRHS, A2, LDA, B, X, LDB,
                                               &(dparam[IPARAM_ANORM]),
                                               &(dparam[IPARAM_BNORM]),
                                               &(dparam[IPARAM_XNORM]) );
69 70

        free(A2); free(B); free(X);
71
    }
72 73 74 75

    free(A);
    return 0;
}