MCPcopy Create free account
hub / github.com/clMathLibraries/clBLAS / compareMatrices

Function compareMatrices

src/tests/include/matrix.h:302–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300
301template <typename T>
302static void
303compareMatrices(
304 clblasOrder order,
305 size_t M,
306 size_t N,
307 const T *A,
308 const T *B,
309 size_t lda,
310 const cl_double *absDelta = NULL)
311{
312 size_t m = 0, n = 0;
313 T ref, clresult;
314 cl_double delta;
315
316 if( lda > 0 ) // General case
317 {
318 for (m = 0; m < M; m++) {
319 for (n = 0; n < N; n++) {
320 ref = getElement<T>(order, clblasNoTrans, m, n, A, lda);
321 clresult = getElement<T>(order, clblasNoTrans, m, n, B, lda);
322 delta = 0.0;
323 if (absDelta != NULL) {
324 delta = absDelta[m * N + n];
325 }
326 if( module(ref-clresult) > delta ) printf("m : %d\t n: %d\n", (int)m, (int)n);
327 ASSERT_NEAR(ref, clresult, delta);
328 }
329 }
330 }
331 else // Packed case
332 {
333 if ( order == clblasColumnMajor)
334 {
335 for ( n = 0; n < N; n++)
336 {
337 for( m=n; m < M; m++)
338 {
339 ref = getElement<T>(order, clblasNoTrans, m, n, A, lda);
340 clresult = getElement<T>(order, clblasNoTrans, m, n, B, lda);
341 delta = 0.0;
342 if (absDelta != NULL) {
343 //delta = absDelta[m * N + n];
344 }
345 if( module(ref-clresult) > delta ) printf("m : %d\t n: %d\n", (int)m, (int)n);
346 ASSERT_NEAR(ref, clresult, delta);
347 }
348 }
349 }
350 else
351 {
352 for ( m = 0; m < M; m++)
353 {
354 for( n = 0; n <= m; n++)
355 {
356 ref = getElement<T>(order, clblasNoTrans, m, n, A, lda);
357 clresult = getElement<T>(order, clblasNoTrans, m, n, B, lda);
358 delta = 0.0;
359 if (absDelta != NULL) {

Callers

nothing calls this directly

Calls 1

moduleFunction · 0.70

Tested by

no test coverage detected