diff options
Diffstat (limited to 'redist/test_dcl.c')
-rw-r--r-- | redist/test_dcl.c | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/redist/test_dcl.c b/redist/test_dcl.c index dc6a93e..ded2863 100644 --- a/redist/test_dcl.c +++ b/redist/test_dcl.c @@ -1,4 +1,5 @@ -//gcc -msse2 -O3 -ftree-vectorize test_dcl.c dclhelpers.c os_generic.c -DFLT=double -lpthread -lcblas && valgrind ./a.out +// gcc -msse2 -O3 -ftree-vectorize test_dcl.c dclhelpers.c os_generic.c -DFLT=double -lpthread -lcblas && valgrind +// ./a.out #include "dclhelpers.h" #include "os_generic.h" @@ -99,44 +100,39 @@ void compareToCblasTrans() { DMS(em1), 0); } -int main() -{ - FLT A[2][4] = { { 0, 1, 2, 3 }, { 4, 5, 6, 7} }; +int main() { + FLT A[2][4] = {{0, 1, 2, 3}, {4, 5, 6, 7}}; FLT B[4][2]; - dclPrint( A[0], 4, 2, 4 ); + dclPrint(A[0], 4, 2, 4); dclTransp(B[0], 2, A[0], 4, 2, 4); - dclPrint( B[0], 2, 4, 2 ); + dclPrint(B[0], 2, 4, 2); int i, j; - for( i = 0; i < 8; i++ ) - { - printf( "%f\n", ((float*)(B[0]))[i] ); + for (i = 0; i < 8; i++) { + printf("%f\n", ((float *)(B[0]))[i]); } - FLT M[3][3] = { - { .32, 1, 0 }, - { 0, 1, 2 }, - { 1, 0, 1 } }; + FLT M[3][3] = {{.32, 1, 0}, {0, 1, 2}, {1, 0, 1}}; FLT Mo[3][3]; - dclInv( Mo[0], 3, M[0], 3, 3 ); - dclPrint( Mo[0], 3, 3, 3 ); + dclInv(Mo[0], 3, M[0], 3, 3); + dclPrint(Mo[0], 3, 3, 3); FLT MM[3][3]; - dclMul( MM[0], 3, M[0], 3, Mo[0], 3, 3, 3, 3 ); + dclMul(MM[0], 3, M[0], 3, Mo[0], 3, 3, 3, 3); - printf( "The following should be an identity matrix\n" ); - dclPrint( MM[0], 3, 3, 3 ); + printf("The following should be an identity matrix\n"); + dclPrint(MM[0], 3, 3, 3); { FLT A[3][4]; - dclIdentity( DMS(A), 3, 4); - dclPrint( DMS(A), 3, 4); + dclIdentity(DMS(A), 3, 4); + dclPrint(DMS(A), 3, 4); FLT x[4][2] = { {7, -7}, {8, -8}, {9, -9}, {10, -10}, }; FLT R[4][2]; - dclZero( DMS(R), 4, 2 ); + dclZero(DMS(R), 4, 2); // dclMul(R, 1, A[0], 4, x, 1, 4, 1, 3); dcldgemm(0, 0, 3, 4, 2, 1, A[0], 4, x[0], 2, 0, R[0], 2); @@ -145,9 +141,8 @@ int main() dclPrint(DMS(R), 3, 2); for (int j = 0; j < 2; j++) { - for (int i = 0; i < 3; i++) - { - printf( "[%d][%d]\n", i, j ); + for (int i = 0; i < 3; i++) { + printf("[%d][%d]\n", i, j); assert(R[i][j] == x[i][j]); } @@ -158,4 +153,3 @@ int main() compareToCblas(); compareToCblasTrans(); } - |