time_ztrsm.c 2.16 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.
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 Faverge
 * @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_ztrsm"
23
/* See Lawn 41 page 120 */
Mathieu Faverge's avatar
Mathieu Faverge committed
24 25
#define _FMULS FMULS_TRSM( ChamLeft, N, NRHS )
#define _FADDS FADDS_TRSM( ChamLeft, N, NRHS )
26 27

#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
{
Mathieu Faverge's avatar
Mathieu Faverge committed
33
    CHAMELEON_Complex64_t alpha;
34 35
    cham_uplo_t uplo = ChamLower;

36
    PASTE_CODE_IPARAM_LOCALS( iparam );
37 38

    LDA = chameleon_max( LDA, N );
39 40

    /* Allocate Data */
Mathieu Faverge's avatar
Mathieu Faverge committed
41 42 43
    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);
44

45 46
     /* Initialize Data */
    CHAMELEON_zplgsy( (CHAMELEON_Complex64_t)N, uplo, N, A, LDA, 453 );
Mathieu Faverge's avatar
Mathieu Faverge committed
47
    CHAMELEON_zplrnt( N, NRHS, B, LDB, 5673 );
48 49 50
    LAPACKE_zlarnv_work(1, ISEED, 1, &alpha);
    alpha = 10.; /*alpha * N  /  2.;*/

51
    if ( check ) {
Mathieu Faverge's avatar
Mathieu Faverge committed
52
        memcpy(B2, B, LDB*NRHS*sizeof(CHAMELEON_Complex64_t));
53 54 55
    }

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

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

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