PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
testing_sgetri.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <plasma.h>
#include <cblas.h>
#include <lapacke.h>
#include <core_blas.h>
#include "testing_smain.h"
Include dependency graph for testing_sgetri.c:

Go to the source code of this file.

Functions

int testing_sgetri (int argc, char **argv)

Detailed Description

PLASMA testing routines PLASMA is a software package provided by Univ. of Tennessee, Univ. of California Berkeley and Univ. of Colorado Denver

Version:
2.4.5
Author:
Hatem Ltaief
Date:
2010-11-15 s Tue Nov 22 14:35:48 2011

Definition in file testing_sgetri.c.


Function Documentation

int testing_sgetri ( int  argc,
char **  argv 
)

Definition at line 29 of file testing_sgetri.c.

References check_factorization(), IPIV, PLASMA_sgetrf(), PLASMA_sgetri(), PLASMA_splrnt(), and USAGE.

{
/* Check for number of arguments*/
if (argc != 2){
USAGE("GETRI", "N LDA",
" - N : the size of the matrix\n"
" - LDA : leading dimension of the matrix A\n");
return -1;
}
int N = atoi(argv[0]);
int LDA = atoi(argv[1]);
float eps;
int info_inverse, info_factorization;
int i, j;
float *A1 = (float *)malloc(LDA*N*sizeof(float));
float *A2 = (float *)malloc(LDA*N*sizeof(float));
float *WORK = (float *)malloc(2*LDA*sizeof(float));
float *D = (float *)malloc(LDA*sizeof(float));
int *IPIV = (int *)malloc(N*sizeof(int));
/* Check if unable to allocate memory */
if ( (!A1) || (!A2) || (!IPIV) ){
printf("Out of Memory \n ");
return -2;
}
eps = LAPACKE_slamch_work('e');
/*-------------------------------------------------------------
* TESTING SGETRI
*/
/* Initialize A1 and A2 Matrix */
PLASMA_splrnt(N, N, A1, LDA, 3453);
for ( i = 0; i < N; i++)
for ( j = 0; j < N; j++)
A2[LDA*j+i] = A1[LDA*j+i];
printf("\n");
printf("------ TESTS FOR PLASMA SGETRI ROUTINE ------- \n");
printf(" Size of the Matrix %d by %d\n", N, N);
printf("\n");
printf(" The matrix A is randomly generated for each test.\n");
printf("============\n");
printf(" The relative machine precision (eps) is to be %e \n", eps);
printf(" Computational tests pass if scaled residuals are less than 60.\n");
/* PLASMA SGETRF */
PLASMA_sgetrf(N, N, A2, LDA, IPIV);
/* Check the factorization */
info_factorization = check_factorization( N, A1, A2, LDA, IPIV, eps);
/* PLASMA SGETRI */
PLASMA_sgetri(N, A2, LDA, IPIV);
/* Check the inverse */
info_inverse = check_inverse(N, A1, A2, LDA, IPIV, eps);
if ( (info_inverse == 0) && (info_factorization == 0) ) {
printf("***************************************************\n");
printf(" ---- TESTING SGETRI ..................... PASSED !\n");
printf("***************************************************\n");
}
else {
printf("***************************************************\n");
printf(" - TESTING SGETRI ... FAILED !\n");
printf("***************************************************\n");
}
free(A1); free(A2); free(IPIV); free(WORK); free(D);
return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function: