43 float *A1 = (
float *)malloc(LDA*N*
sizeof(
float));
44 float *A2 = (
float *)malloc(LDA*N*
sizeof(
float));
45 float *B1 = (
float *)malloc(LDB*NRHS*
sizeof(
float));
46 float *B2 = (
float *)malloc(LDB*NRHS*
sizeof(
float));
49 if ((!A1)||(!A2)||(!B1)||(!B2)){
50 printf(
"Out of Memory \n ");
56 printf(
"-- PLASMA is initialized to run on %d cores. \n",cores);
76 if ((info_solution != 0)|(info != 0))
77 printf(
"-- Error in SPOSV example ! \n");
79 printf(
"-- Run of SPOSV example successful ! \n");
81 free(A1); free(A2); free(B1); free(B2);
92 int check_solution(
int N,
int NRHS,
float *A1,
int LDA,
float *B1,
float *B2,
int LDB)
95 float Rnorm, Anorm, Xnorm, Bnorm;
97 float *work = (
float *)malloc(N*
sizeof(
float));
100 eps = LAPACKE_slamch_work(
'e');
109 cblas_sgemm(
CblasColMajor,
CblasNoTrans,
CblasNoTrans, N, NRHS, N, (alpha), A1, LDA, B2, LDB, (beta), B1, LDB);
112 printf(
"============\n");
113 printf(
"Checking the Residual of the solution \n");
114 printf(
"-- ||Ax-B||_oo/((||A||_oo||x||_oo+||B||_oo).N.eps) = %e \n",Rnorm/((Anorm*Xnorm+Bnorm)*N*eps));
116 if (Rnorm/((Anorm*Xnorm+Bnorm)*N*eps) > 10.0){
117 printf(
"-- The solution is suspicious ! \n");
121 printf(
"-- The solution is CORRECT ! \n");
127 return info_solution;