PLASMA
2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
Main Page
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
testing_zgetmi.c
Go to the documentation of this file.
1
24
#include <stdlib.h>
25
#include <stdio.h>
26
#include <string.h>
27
#include <lapacke.h>
28
#include <
plasma.h
>
29
#include "
testing_zmain.h
"
30
31
static
int
check_solution
(
int
m,
int
n,
int
mb,
int
nb,
32
PLASMA_Complex64_t
*
A
,
PLASMA_Complex64_t
*
B
,
33
int
(*mapA)(
int
,
int
,
int
,
int
,
int
,
int
)) {
34
int
i, j;
35
36
for
( j=0; j<n; j++) {
37
for
(i=0; i<m; i++) {
38
if
(A[ mapA(m, n, mb, nb, i, j) ] != B[ mapA(n, m, mb, nb, j, i) ] ) {
39
return
-1;
40
}
41
}
42
}
43
return
0;
44
}
45
46
int
testing_zgetmi
(
int
argc,
char
**argv){
47
48
PLASMA_Complex64_t
*
A
, *
B
;
49
int
m, n, mb, nb;
50
int
i, ret, size;
51
52
/* Check for number of arguments*/
53
if
(argc != 4){
54
USAGE
(
"GETMI"
,
"M N MB NB ntdbypb with \n"
,
55
" - M : the number of rows of the matrix \n"
56
" - N : the number of columns of the matrix \n"
57
" - MB : the number of rows of each block \n"
58
" - NB : the number of columns of each block \n"
);
59
return
-1;
60
}
61
62
m = atoi(argv[0]);
63
n = atoi(argv[1]);
64
mb = atoi(argv[2]);
65
nb = atoi(argv[3]);
66
67
size = m*n*
sizeof
(
PLASMA_Complex64_t
);
68
A = (
PLASMA_Complex64_t
*)malloc(size);
69
B = (
PLASMA_Complex64_t
*)malloc(size);
70
LAPACKE_zlarnv_work(1,
ISEED
, m*n, A);
71
72
for
(i=0; i<6; i++) {
73
memcpy(B, A, size);
74
75
printf(
" - TESTING ZGETMI (%4s) ..."
,
formatstr
[i]);
76
ret =
PLASMA_zgetmi
( m, n, A,
format
[i], mb, nb );
77
78
if
(ret !=
PLASMA_SUCCESS
) {
79
printf(
"Failed\n"
);
80
continue
;
81
}
82
83
if
(
check_solution
(m, n, mb, nb, B, A,
84
(
int
(*)(
int
,
int
,
int
,
int
,
int
,
int
))
formatmap
[i]) == 0 )
85
printf(
"............ PASSED !\n"
);
86
else
87
printf(
"... FAILED !\n"
);
88
}
89
90
free( A ); free( B );
91
92
return
0;
93
}
plasma_2.4.5
testing
testing_zgetmi.c
Generated on Mon Jul 9 2012 12:45:06 for PLASMA by
1.8.1