diff --git a/example/lapack_to_morse/step0.c b/example/lapack_to_morse/step0.c index f5cbfc34408ab63bea44b72711df6f35fc7be6f2..6879a1ef1e3ab1f0fde0ddb067255e842bb91128 100644 --- a/example/lapack_to_morse/step0.c +++ b/example/lapack_to_morse/step0.c @@ -71,9 +71,10 @@ int main(int argc, char *argv[]) { * - set of RHS vectors B : size N x NRHS * - set of solutions vectors X : size N x NRHS */ - PASTE_CODE_ALLOCATE_MATRIX( A, double, N, N ); - PASTE_CODE_ALLOCATE_MATRIX( B, double, N, NRHS ); - PASTE_CODE_ALLOCATE_MATRIX( X, double, N, NRHS ); + double *A = malloc( N * N * sizeof(double) ); + double *Acpy = malloc( N * N * sizeof(double) ); + double *B = malloc( N * NRHS * sizeof(double) ); + double *X = malloc( N * NRHS * sizeof(double) ); /* generate A matrix with random values such that it is spd */ CORE_dplgsy( (double)N, N, N, A, N, N, N, N, 51 ); @@ -82,8 +83,7 @@ int main(int argc, char *argv[]) { CORE_dplrnt( N, NRHS, B, N, N, N, NRHS, 5673 ); /* copy A before facto. in order to check the result */ - PASTE_CODE_ALLOCATE_MATRIX( Acpy, double, N, N ); - memcpy(Acpy, A, N*N*sizeof(double)); + memcpy(Acpy, A, N * N * sizeof(double)); /* copy B in X before solving */ memcpy(X, B, N*NRHS*sizeof(double)); diff --git a/example/lapack_to_morse/step0.h b/example/lapack_to_morse/step0.h index 7ca73889108f9b0f770f223b5b55a318a011418e..0f3f87672b85532ae2a6c03f9d23d5b8a6cea518 100644 --- a/example/lapack_to_morse/step0.h +++ b/example/lapack_to_morse/step0.h @@ -120,15 +120,4 @@ static void print_header(char *prog_name, int * iparam) { return; } -/** - * Macro to allocate a matrix as a 1D array - */ -#define PASTE_CODE_ALLOCATE_MATRIX(_name_, _type_, _m_, _n_) \ - _type_ *_name_ = NULL; \ - _name_ = (_type_*)malloc( (_m_) * (_n_) * sizeof(_type_) ); \ - if ( ! _name_ ) { \ - fprintf(stderr, "Out of Memory for %s\n", #_name_); \ - return -1; \ - } - #endif /* STEP0_H */ diff --git a/example/lapack_to_morse/step1.c b/example/lapack_to_morse/step1.c index 930055a7617180052fff10e9c08a301f10f21238..6099a6f9a673f2df637a93b3f28d02f9cd16c1cb 100644 --- a/example/lapack_to_morse/step1.c +++ b/example/lapack_to_morse/step1.c @@ -93,10 +93,10 @@ int main(int argc, char *argv[]) { * - set of RHS vectors B : size N x NRHS * - set of solutions vectors X : size N x NRHS */ - PASTE_CODE_ALLOCATE_MATRIX( A, double, N, N ); - PASTE_CODE_ALLOCATE_MATRIX( B, double, N, NRHS ); - PASTE_CODE_ALLOCATE_MATRIX( X, double, N, NRHS ); - PASTE_CODE_ALLOCATE_MATRIX( Acpy, double, N, N ); + double *A = malloc( N * N * sizeof(double) ); + double *Acpy = malloc( N * N * sizeof(double) ); + double *B = malloc( N * NRHS * sizeof(double) ); + double *X = malloc( N * NRHS * sizeof(double) ); /* generate A matrix with random values such that it is spd */ MORSE_dplgsy( (double)N, MorseUpperLower, N, A, N, 51 ); diff --git a/example/lapack_to_morse/step1.h b/example/lapack_to_morse/step1.h index 0b76f1de5f61a221fe14707e95622a420277e8c8..92a9fb8b031303fd1e07d5c0702a6f78001b3108 100644 --- a/example/lapack_to_morse/step1.h +++ b/example/lapack_to_morse/step1.h @@ -119,15 +119,4 @@ static void print_header(char *prog_name, int * iparam) { return; } -/** - * Macro to allocate a matrix as a 1D array - */ -#define PASTE_CODE_ALLOCATE_MATRIX(_name_, _type_, _m_, _n_) \ - _type_ *_name_ = NULL; \ - _name_ = (_type_*)malloc( (_m_) * (_n_) * sizeof(_type_) ); \ - if ( ! _name_ ) { \ - fprintf(stderr, "Out of Memory for %s\n", #_name_); \ - return -1; \ - } - #endif /* STEP1_H */ diff --git a/example/lapack_to_morse/step2.c b/example/lapack_to_morse/step2.c index 0a51acd1e39a8c03beb0f6dd8b5b62c8a159f080..fbb13949987b0d2379a3e5fabe0b1943f5e59fb2 100644 --- a/example/lapack_to_morse/step2.c +++ b/example/lapack_to_morse/step2.c @@ -91,10 +91,10 @@ int main(int argc, char *argv[]) { * - set of RHS vectors B : size N x NRHS * - set of solutions vectors X : size N x NRHS */ - PASTE_CODE_ALLOCATE_MATRIX( A, double, N, N ); - PASTE_CODE_ALLOCATE_MATRIX( B, double, N, NRHS ); - PASTE_CODE_ALLOCATE_MATRIX( X, double, N, NRHS ); - PASTE_CODE_ALLOCATE_MATRIX( Acpy, double, N, N ); + double *A = malloc( N * N * sizeof(double) ); + double *Acpy = malloc( N * N * sizeof(double) ); + double *B = malloc( N * NRHS * sizeof(double) ); + double *X = malloc( N * NRHS * sizeof(double) ); /* * Initialize the structure required for MORSE tile interface diff --git a/example/lapack_to_morse/step2.h b/example/lapack_to_morse/step2.h index 86eb985dff1f9a49de90860b19dc49fe377c6c58..2e72b11b072dbc93dfa8a6f88b661718400de778 100644 --- a/example/lapack_to_morse/step2.h +++ b/example/lapack_to_morse/step2.h @@ -119,15 +119,4 @@ static void print_header(char *prog_name, int * iparam) { return; } -/** - * Macro to allocate a matrix as a 1D array - */ -#define PASTE_CODE_ALLOCATE_MATRIX(_name_, _type_, _m_, _n_) \ - _type_ *_name_ = NULL; \ - _name_ = (_type_*)malloc( (_m_) * (_n_) * sizeof(_type_) ); \ - if ( ! _name_ ) { \ - fprintf(stderr, "Out of Memory for %s\n", #_name_); \ - return -1; \ - } - #endif /* STEP2_H */