time_zposv.c 1.85 KB
Newer Older
1
/**
2 3
 *
 * @file time_zposv.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-2014 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
 * @precisions normal z -> c d s
 *
 **/
#define _TYPE  MORSE_Complex64_t
#define _PREC  double
#define _LAMCH LAPACKE_dlamch_work

#define _NAME  "MORSE_zposv"
/* See Lawn 41 page 120 */
#define _FMULS (FMULS_POTRF( N ) + FMULS_POTRS( N, NRHS ))
#define _FADDS (FADDS_POTRF( N ) + FADDS_POTRS( N, NRHS ))

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

static int
29
RunTest(int *iparam, double *dparam, morse_time_t *t_)
30 31 32
{
    PASTE_CODE_IPARAM_LOCALS( iparam );
    MORSE_enum uplo = MorseUpper;
33 34 35

    LDA = chameleon_max(LDA, N);

36 37 38
    /* Allocate Data */
    PASTE_CODE_ALLOCATE_MATRIX( A, 1, MORSE_Complex64_t, LDA, N    );
    PASTE_CODE_ALLOCATE_MATRIX( X, 1, MORSE_Complex64_t, LDB, NRHS );
39

40
    /* Initialiaze Data */
41
    MORSE_zplghe((double)N, MorseUpperLower, N, A, LDA, 51 );
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
    MORSE_zplrnt( N, NRHS, X, LDB, 5673 );

    /* Save A and b  */
    PASTE_CODE_ALLOCATE_COPY( Acpy, check, MORSE_Complex64_t, A, LDA, N    );
    PASTE_CODE_ALLOCATE_COPY( B,    check, MORSE_Complex64_t, X, LDB, NRHS );

    /* MORSE ZPOSV */
    START_TIMING();
    MORSE_zposv(uplo, N, NRHS, A, LDA, X, LDB);
    STOP_TIMING();

    /* Check the solution */
    if (check)
      {
        dparam[IPARAM_RES] = z_check_solution(N, N, NRHS, Acpy, LDA, B, X, LDB,
57 58
                                              &(dparam[IPARAM_ANORM]),
                                              &(dparam[IPARAM_BNORM]),
59 60 61 62
                                              &(dparam[IPARAM_XNORM]));
        free(Acpy); free(B);
      }

63
    free(A); free(X);
64 65 66

    return 0;
}