time_ztrsm.c 2.12 KB
Newer Older
1
/**
2 3
 *
 * @file time_ztrsm.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_ztrsm"
21
/* See Lawn 41 page 120 */
22 23
#define _FMULS FMULS_TRSM( ChamLeft, N, NRHS )
#define _FADDS FADDS_TRSM( ChamLeft, N, NRHS )
24 25

#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
    CHAMELEON_Complex64_t alpha;
32 33
    cham_uplo_t uplo = ChamLower;

34
    PASTE_CODE_IPARAM_LOCALS( iparam );
35 36

    LDA = chameleon_max( LDA, N );
37 38

    /* Allocate Data */
39 40 41
    PASTE_CODE_ALLOCATE_MATRIX( A,      1, CHAMELEON_Complex64_t, LDA, N   );
    PASTE_CODE_ALLOCATE_MATRIX( B,      1, CHAMELEON_Complex64_t, LDB, NRHS);
    PASTE_CODE_ALLOCATE_MATRIX( B2, check, CHAMELEON_Complex64_t, LDB, NRHS);
42

43 44
     /* Initialize Data */
    CHAMELEON_zplgsy( (CHAMELEON_Complex64_t)N, uplo, N, A, LDA, 453 );
45
    CHAMELEON_zplrnt( N, NRHS, B, LDB, 5673 );
46 47 48
    LAPACKE_zlarnv_work(1, ISEED, 1, &alpha);
    alpha = 10.; /*alpha * N  /  2.;*/

49
    if ( check ) {
50
        memcpy(B2, B, LDB*NRHS*sizeof(CHAMELEON_Complex64_t));
51 52 53
    }

    START_TIMING();
54 55
    CHAMELEON_ztrsm( ChamLeft, uplo, ChamNoTrans, ChamUnit,
                     N, NRHS, alpha, A, LDA, B, LDB );
56 57 58
    STOP_TIMING();

    /* Check the solution */
59
    if ( check )
60
    {
61
        dparam[IPARAM_RES] = z_check_trsm( ChamLeft, uplo, ChamNoTrans, ChamUnit,
62 63
                                           N, NRHS,
                                           alpha, A, LDA, B, B2, LDB,
64
                                           &(dparam[IPARAM_ANORM]),
65 66 67 68 69 70 71 72 73
                                           &(dparam[IPARAM_BNORM]),
                                           &(dparam[IPARAM_XNORM]));
        free(B2);
    }

    free( A );
    free( B );
    return 0;
}