MCPcopy Create free account
hub / github.com/AdvancedCompiler/AdvancedCompiler / Verify_matrix_c

Function Verify_matrix_c

code/Chapter12/mympi.h:107–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105 printf("----------------------------------\n");
106}
107void Verify_matrix_c(float *A,float * B,float *C,int m1,int n1,int n2){
108 float *matrixPool;
109 int i;
110 matrixPool=(float *)malloc(sizeof(float)*m1*n2);
111 Init_Matrix(matrixPool,m1*n2,1);
112 Mul_Matrix(A,B,matrixPool,m1,n1,n2);
113 for(i=0;i<m1*n2;i++){
114 if(C[i]!=matrixPool[i]){
115 printf("计算结果错误!\n");
116 if(m1*n2<=36){
117 printf("A:\n");
118 Print_matrix(A,m1,n1);
119 printf("B:\n");
120 Print_matrix(B,n1,n2);
121 printf("C:\n");
122 Print_matrix(C,m1,n2);
123 printf("real-C:\n");
124 Print_matrix(matrixPool,m1,n2);
125 }
126 return;
127 }
128 }
129 printf("计算结果正确!\n");
130}
131#endif

Callers

nothing calls this directly

Calls 3

Init_MatrixFunction · 0.70
Mul_MatrixFunction · 0.70
Print_matrixFunction · 0.70

Tested by

no test coverage detected