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_dlange.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_dmain.h"
Include dependency graph for testing_dlange.c:

Go to the source code of this file.

Macros

#define REAL

Functions

int testing_dlange (int argc, char **argv)

Variables

int norm [4] = { PlasmaMaxNorm, PlasmaOneNorm, PlasmaInfNorm, PlasmaFrobeniusNorm }
char * normstr [4] = { "Max", "One", "Inf", "Fro" }

Macro Definition Documentation

#define REAL

Definition at line 28 of file testing_dlange.c.


Function Documentation

int testing_dlange ( int  argc,
char **  argv 
)

Definition at line 34 of file testing_dlange.c.

References A, cimag(), IONE, ISEED, lapack_const, max, min, norm, normstr, PLASMA_dlange, PLASMA_dlansy, uplo, uplostr, and USAGE.

{
/* Check for number of arguments*/
if ( argc != 3) {
USAGE("LANGE", "M N LDA",
" - M : number of rows of matrices A and C\n"
" - N : number of columns of matrices B and C\n"
" - LDA : leading dimension of matrix A\n");
return -1;
}
int M = atoi(argv[0]);
int N = atoi(argv[1]);
int LDA = atoi(argv[2]);
int LDAxN = LDA*N;
int n, u;
double eps;
double *A = (double *)malloc(LDAxN*sizeof(double));
double *work = (double*) malloc(max(M,N)*sizeof(double));
double normplasma, normlapack;
eps = LAPACKE_dlamch_work('e');
printf("\n");
printf("------ TESTS FOR PLASMA DLANGE ROUTINE ------- \n");
printf(" Size of the Matrix %d by %d\n", M, 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 10.\n");
/*----------------------------------------------------------
* TESTING DLANGE
*/
/* Initialize A, B, C */
LAPACKE_dlarnv_work(IONE, ISEED, LDAxN, A);
/* PLASMA DLANGE */
for(n=0; n<3; n++) {
normplasma = PLASMA_dlange(norm[n], M, N, A, LDA, work);
normlapack = LAPACKE_dlange_work(LAPACK_COL_MAJOR, lapack_const(norm[n]), M, N, A, LDA, work);
printf("Lapack %e, Plasma %e\n", normlapack, normplasma);
printf("***************************************************\n");
if ( abs(normlapack-normplasma) < eps ) {
printf(" ---- TESTING DLANGE (%s)............... PASSED !\n", normstr[n]);
}
else {
printf(" - TESTING DLANGE (%s)... FAILED !\n", normstr[n]);
}
printf("***************************************************\n");
}
/* PLASMA DLANSY */
for(n=0; n<3; n++) {
for(u=0; u<2; u++) {
normplasma = PLASMA_dlansy(norm[n], uplo[u], min(M,N), A, LDA, work);
normlapack = LAPACKE_dlansy_work(LAPACK_COL_MAJOR, lapack_const(norm[n]), lapack_const(uplo[u]), min(M,N), A, LDA, work);
printf("Lapack %e, Plasma %e\n", normlapack, normplasma);
printf("***************************************************\n");
if ( abs(normlapack-normplasma) < eps ) {
printf(" ---- TESTING DLANSY (%s, %s)......... PASSED !\n", normstr[n], uplostr[u]);
}
else {
printf(" - TESTING DLANSY (%s, %s)... FAILED !\n", normstr[n], uplostr[u]);
}
printf("***************************************************\n");
}
}
#ifdef COMPLEX
/* PLASMA DLANSY */
{
int j;
for (j=0; j<min(M,N); j++) {
A[j*LDA+j] -= I*cimag(A[j*LDA+j]);
}
}
for(n=0; n<3; n++) {
for(u=0; u<2; u++) {
normplasma = PLASMA_dlansy(norm[n], uplo[u], min(M,N), A, LDA, work);
normlapack = LAPACKE_dlansy_work(LAPACK_COL_MAJOR, lapack_const(norm[n]), lapack_const(uplo[u]), min(M,N), A, LDA, work);
printf("Lapack %e, Plasma %e\n", normlapack, normplasma);
printf("***************************************************\n");
if ( abs(normlapack-normplasma) < eps ) {
printf(" ---- TESTING DLANSY (%s, %s)......... PASSED !\n", normstr[n], uplostr[u]);
}
else {
printf(" - TESTING DLANSY (%s, %s)... FAILED !\n", normstr[n], uplostr[u]);
}
printf("***************************************************\n");
}
}
#endif
free(A); free(work);
return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 30 of file testing_dlange.c.

char* normstr[4] = { "Max", "One", "Inf", "Fro" }

Definition at line 31 of file testing_dlange.c.