time_ztrsm.c 2.1 KB
Newer Older
1 2
/**
 *
3 4
 * @copyright (c) 2009-2014 The University of Tennessee and The University
 *                          of Tennessee Research Foundation.
5 6
 *                          All rights reserved.
 * @copyright (c) 2012-2014 Inria. All rights reserved.
7
 * @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
8 9 10 11 12 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_ztrsm"
/* See Lawn 41 page 120 */
#define _FMULS FMULS_TRSM( MorseLeft, N, NRHS )
#define _FADDS FADDS_TRSM( MorseLeft, N, NRHS )

#include "./timing.c"
26
#include "timing_zauxiliary.h"
27 28 29 30 31 32

static int
RunTest(int *iparam, double *dparam, morse_time_t *t_)
{
    MORSE_Complex64_t alpha;
    PASTE_CODE_IPARAM_LOCALS( iparam );
33 34

    LDA = chameleon_max( LDA, N );
35 36 37 38 39 40 41

    /* Allocate Data */
    PASTE_CODE_ALLOCATE_MATRIX( A,      1, MORSE_Complex64_t, LDA, N   );
    PASTE_CODE_ALLOCATE_MATRIX( B,      1, MORSE_Complex64_t, LDB, NRHS);
    PASTE_CODE_ALLOCATE_MATRIX( B2, check, MORSE_Complex64_t, LDB, NRHS);

     /* Initialiaze Data */
42
    MORSE_zplgsy( (MORSE_Complex64_t)N, MorseUpperLower, N, A, LDA, 453 );
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
    MORSE_zplrnt( N, NRHS, B, LDB, 5673 );
    LAPACKE_zlarnv_work(1, ISEED, 1, &alpha);
    alpha = 10.; /*alpha * N  /  2.;*/

    if (check)
    {
        memcpy(B2, B, LDB*NRHS*sizeof(MORSE_Complex64_t));
    }

    START_TIMING();
    MORSE_ztrsm( MorseLeft, MorseUpper, MorseNoTrans, MorseUnit,
                  N, NRHS, alpha, A, LDA, B, LDB );
    STOP_TIMING();

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

    free( A );
    free( B );

    return 0;
}