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_strsm.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_strsm.c:

Go to the source code of this file.

Macros

#define REAL

Functions

int testing_strsm (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:
Mathieu Faverge
Date:
2010-11-15 s Tue Nov 22 14:35:50 2011

Definition in file testing_strsm.c.


Macro Definition Documentation

#define REAL

Definition at line 27 of file testing_strsm.c.


Function Documentation

int testing_strsm ( int  argc,
char **  argv 
)

Definition at line 34 of file testing_strsm.c.

References A, B, cblas_saxpy(), cblas_strsm(), CblasColMajor, check_solution(), diag, diagstr, IONE, ISEED, lapack_const, max, PLASMA_strsm(), PlasmaInfNorm, PlasmaLeft, side, sidestr, trans, transstr, uplo, uplostr, and USAGE.

{
/* Check for number of arguments*/
if ( argc != 5 ) {
USAGE("TRSM", "alpha M N LDA LDB",
" - alpha : alpha coefficient\n"
" - M : number of rows of matrices B\n"
" - N : number of columns of matrices B\n"
" - LDA : leading dimension of matrix A\n"
" - LDB : leading dimension of matrix B\n");
return -1;
}
float alpha = (float) atol(argv[0]);
int M = atoi(argv[1]);
int N = atoi(argv[2]);
int LDA = atoi(argv[3]);
int LDB = atoi(argv[4]);
float eps;
int info_solution;
int s, u, t, d, i;
int LDAxM = LDA*max(M,N);
int LDBxN = LDB*max(M,N);
float *A = (float *)malloc(LDAxM*sizeof(float));
float *B = (float *)malloc(LDBxN*sizeof(float));
float *Binit = (float *)malloc(LDBxN*sizeof(float));
float *Bfinal = (float *)malloc(LDBxN*sizeof(float));
/* Check if unable to allocate memory */
if ( (!A) || (!B) || (!Binit) || (!Bfinal)){
printf("Out of Memory \n ");
return -2;
}
eps = LAPACKE_slamch_work('e');
printf("\n");
printf("------ TESTS FOR PLASMA STRSM ROUTINE ------- \n");
printf(" Size of the Matrix B : %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 STRSM
*/
/* Initialize A, B, C */
LAPACKE_slarnv_work(IONE, ISEED, LDAxM, A);
LAPACKE_slarnv_work(IONE, ISEED, LDBxN, B);
for(i=0;i<max(M,N);i++)
A[LDA*i+i] = A[LDA*i+i] + 2.0;
for (s=0; s<2; s++) {
for (u=0; u<2; u++) {
#ifdef COMPLEX
for (t=0; t<3; t++) {
#else
for (t=0; t<2; t++) {
#endif
for (d=0; d<2; d++) {
memcpy(Binit, B, LDBxN*sizeof(float));
memcpy(Bfinal, B, LDBxN*sizeof(float));
/* PLASMA STRSM */
PLASMA_strsm(side[s], uplo[u], trans[t], diag[d],
M, N, alpha, A, LDA, Bfinal, LDB);
/* Check the solution */
info_solution = check_solution(side[s], uplo[u], trans[t], diag[d],
M, N, alpha, A, LDA, Binit, Bfinal, LDB);
printf("***************************************************\n");
if (info_solution == 0) {
printf(" ---- TESTING STRSM (%s, %s, %s, %s) ...... PASSED !\n",
sidestr[s], uplostr[u], transstr[t], diagstr[d]);
}
else {
printf(" ---- TESTING STRSM (%s, %s, %s, %s) ... FAILED !\n",
sidestr[s], uplostr[u], transstr[t], diagstr[d]);
}
printf("***************************************************\n");
}
}
}
}
free(A); free(B);
free(Binit); free(Bfinal);
return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function: