time_zgetrf_incpiv.c 2.19 KB
Newer Older
1
/**
2 3
 *
 * @file time_zgetrf_incpiv.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_zgetrf_incpiv_Tile"
23 24 25 26 27
/* See Lawn 41 page 120 */
#define _FMULS FMULS_GETRF(M, N)
#define _FADDS FADDS_GETRF(M, 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
{
Mathieu Faverge's avatar
Mathieu Faverge committed
33
    CHAM_desc_t *L;
34 35
    int *piv;
    PASTE_CODE_IPARAM_LOCALS( iparam );
36

37 38 39 40 41 42
    if ( M != N && check ) {
        fprintf(stderr, "Check cannot be perfomed with M != N\n");
        check = 0;
    }

    /* Allocate Data */
Mathieu Faverge's avatar
Mathieu Faverge committed
43
    PASTE_CODE_ALLOCATE_MATRIX( A, 1, CHAMELEON_Complex64_t, LDA, N );
44

45
    /* Initialize Data */
Mathieu Faverge's avatar
Mathieu Faverge committed
46
    CHAMELEON_zplrnt(M, N, A, LDA, 3456);
47 48

    /* Allocate Workspace */
Mathieu Faverge's avatar
Mathieu Faverge committed
49
    CHAMELEON_Alloc_Workspace_zgesv_incpiv( chameleon_min(M,N), &L, &piv, P, Q);
50 51

    /* Save AT in lapack layout for check */
Mathieu Faverge's avatar
Mathieu Faverge committed
52
    PASTE_CODE_ALLOCATE_COPY( Acpy, check, CHAMELEON_Complex64_t, A, LDA, N );
53 54

    START_TIMING();
Mathieu Faverge's avatar
Mathieu Faverge committed
55
    CHAMELEON_zgetrf_incpiv( M, N, A, LDA, L, piv );
56
    STOP_TIMING();
57

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

Mathieu Faverge's avatar
Mathieu Faverge committed
65
        CHAMELEON_zgetrs_incpiv( ChamNoTrans, N, NRHS, A, LDA, L, piv, X, LDB );
66 67

        dparam[IPARAM_RES] = z_check_solution(M, N, NRHS, Acpy, LDA, B, X, LDB,
68 69
                                              &(dparam[IPARAM_ANORM]),
                                              &(dparam[IPARAM_BNORM]),
70
                                              &(dparam[IPARAM_XNORM]));
71

72 73 74 75 76 77 78 79 80
        free( Acpy ); free( B ); free( X );
    }

    free( A );
    free( L );
    free( piv );

    return 0;
}