/////////////////////////////////////////////////////////////////////////////// // // FILE: dotprod_main.c // /////////////////////////////////////////////////////////////////////////////// #include #include #include /////////////////////////////////////////////////////////////////////////////// // global variables /////////////////////////////////////////////////////////////////////////////// int a[] = { 66, 140, 48, 4, -121, -178, -146, 14, 231, 383, 328, -15, -607, -1286, -1827, 6160, -1827, -1286, -607, -15 }; int b[] = { 86, 115, -77, -103, 24, 187, 18, -248, -132, 319, 327, -374, -744, 412, 2564, 3671, 2564, 412, -744, -374, }; int c[] = { 0, 18957, -3290, 8595, -5323, 5597, -5323, 462, -3290, -15497, 0, 15497, 3290, -462, 5323, -5597, 5323, -8595, 3290, -18957 }; int d[] = { 319, 327, -374, -744, 412, 5323, -8595, 3290, -18957, 0 }; /////////////////////////////////////////////////////////////////////////////// // function prototypes /////////////////////////////////////////////////////////////////////////////// extern int a_dot_b( int *, int * ); extern int a_dot_c( int *, int * ); extern int a_dot_d( int *, int * ); /////////////////////////////////////////////////////////////////////////////// // void main() /////////////////////////////////////////////////////////////////////////////// void main() { int i; int result[3] = {0}; result[0] = a_dot_b( a, b ); result[1] = a_dot_c( a, c ); result[2] = a_dot_d( a, d ); for( i=0; i<3; i++ ) { printf( "Dot product [%d] = %d\n", i, result[i] ); } }