#include <m4ri/config.h>
#include <stdlib.h>
#include <m4ri/m4ri.h>
int ret = 0;
printf(" mul: m: %4d, l: %4d, n: %4d, k: %2d, cutoff: %4d", m, l, n, k, cutoff);
printf(" Strassen != M4RM");
ret -=1;
}
printf(" M4RM != Naiv");
ret -= 1;
}
printf(" Strassen != Naiv");
ret -= 1;
}
#if __M4RI_HAVE_OPENMP
printf(" MP != Naiv");
ret -= 1;
}
#endif
if(ret==0) {
printf(" ... passed\n");
} else {
printf(" ... FAILED\n");
}
return ret;
}
int sqr_test_equality(
rci_t m,
int k,
int cutoff) {
int ret = 0;
printf(" sqr: m: %4d, k: %2d, cutoff: %4d", m, k, cutoff);
printf(" Strassen != M4RM");
ret -=1;
}
printf(" M4RM != Naiv");
ret -= 1;
}
printf(" Strassen != Naiv");
ret -= 1;
}
if(ret==0) {
printf(" ... passed\n");
} else {
printf(" ... FAILED\n");
}
return ret;
}
int ret = 0;
printf("addmul: m: %4d, l: %4d, n: %4d, k: %2d, cutoff: %4d", m, l, n, k, cutoff);
printf(" M4RM != add,mul");
ret -=1;
}
printf(" add,mul = addmul");
ret -=1;
}
printf(" M4RM != addmul");
ret -=1;
}
#if __M4RI_HAVE_OPENMP
printf(" MP != Naiv");
ret -= 1;
}
#endif
if (ret==0)
printf(" ... passed\n");
else
printf(" ... FAILED\n");
return ret;
}
int addsqr_test_equality(
rci_t m,
int k,
int cutoff) {
int ret = 0;
mzd_t *A, *C, *D, *E, *F;
printf("addsqr: m: %4d, k: %2d, cutoff: %4d", m, k, cutoff);
printf(" M4RM != add,mul");
ret -=1;
}
printf(" add,mul = addmul");
ret -=1;
}
printf(" M4RM != addmul");
ret -=1;
}
if (ret==0)
printf(" ... passed\n");
else
printf(" ... FAILED\n");
return ret;
}
int main() {
int status = 0;
srandom(17);
status += mul_test_equality( 1, 1, 1, 0, 1024);
status += mul_test_equality( 1, 128, 128, 0, 0);
status += mul_test_equality( 3, 131, 257, 0, 0);
status += mul_test_equality( 64, 64, 64, 0, 64);
status += mul_test_equality( 128, 128, 128, 0, 64);
status += mul_test_equality( 21, 171, 31, 0, 63);
status += mul_test_equality( 21, 171, 31, 0, 131);
status += mul_test_equality( 193, 65, 65, 8, 64);
status += mul_test_equality(1025, 1025, 1025, 3, 256);
status += mul_test_equality(2048, 2048, 4096, 0, 1024);
status += mul_test_equality(4096, 3528, 4096, 0, 1024);
status += mul_test_equality(1024, 1025, 1, 0, 1024);
status += mul_test_equality(1000, 1000, 1000, 0, 256);
status += mul_test_equality(1000, 10, 20, 0, 64);
status += mul_test_equality(1710, 1290, 1000, 0, 256);
status += mul_test_equality(1290, 1710, 200, 0, 64);
status += mul_test_equality(1290, 1710, 2000, 0, 256);
status += mul_test_equality(1290, 1290, 2000, 0, 64);
status += mul_test_equality(1000, 210, 200, 0, 64);
status += addmul_test_equality( 1, 128, 128, 0, 0);
status += addmul_test_equality( 3, 131, 257, 0, 0);
status += addmul_test_equality( 64, 64, 64, 0, 64);
status += addmul_test_equality( 128, 128, 128, 0, 64);
status += addmul_test_equality( 21, 171, 31, 0, 63);
status += addmul_test_equality( 21, 171, 31, 0, 131);
status += addmul_test_equality( 193, 65, 65, 8, 64);
status += addmul_test_equality(1025, 1025, 1025, 3, 256);
status += addmul_test_equality(4096, 4096, 4096, 0, 2048);
status += addmul_test_equality(1000, 1000, 1000, 0, 256);
status += addmul_test_equality(1000, 10, 20, 0, 64);
status += addmul_test_equality(1710, 1290, 1000, 0, 256);
status += addmul_test_equality(1290, 1710, 200, 0, 64);
status += addmul_test_equality(1290, 1710, 2000, 0, 256);
status += addmul_test_equality(1290, 1290, 2000, 0, 64);
status += addmul_test_equality(1000, 210, 200, 0, 64);
status += sqr_test_equality( 1, 0, 1024);
status += sqr_test_equality( 128, 0, 0);
status += sqr_test_equality( 131, 0, 0);
status += sqr_test_equality( 64, 0, 64);
status += sqr_test_equality( 128, 0, 64);
status += sqr_test_equality( 171, 0, 63);
status += sqr_test_equality( 171, 0, 131);
status += sqr_test_equality( 193, 8, 64);
status += sqr_test_equality(1025, 3, 256);
status += sqr_test_equality(2048, 0, 1024);
status += sqr_test_equality(3528, 0, 1024);
status += sqr_test_equality(1000, 0, 256);
status += sqr_test_equality(1000, 0, 64);
status += sqr_test_equality(1710, 0, 256);
status += sqr_test_equality(1290, 0, 64);
status += sqr_test_equality(2000, 0, 256);
status += sqr_test_equality(2000, 0, 64);
status += sqr_test_equality( 210, 0, 64);
status += addsqr_test_equality( 1, 0, 0);
status += addsqr_test_equality( 131, 0, 0);
status += addsqr_test_equality( 64, 0, 64);
status += addsqr_test_equality( 128, 0, 64);
status += addsqr_test_equality( 171, 0, 63);
status += addsqr_test_equality( 171, 0, 131);
status += addsqr_test_equality( 193, 8, 64);
status += addsqr_test_equality(1025, 3, 256);
status += addsqr_test_equality(4096, 0, 2048);
status += addsqr_test_equality(1000, 0, 256);
status += addsqr_test_equality(1000, 0, 64);
status += addsqr_test_equality(1710, 0, 256);
status += addsqr_test_equality(1290, 0, 64);
status += addsqr_test_equality(2000, 0, 256);
status += addsqr_test_equality(2000, 0, 64);
status += addsqr_test_equality( 210, 0, 64);
if (status == 0) {
printf("All tests passed.\n");
return 0;
} else {
return -1;
}
}