/* Copyright 2001 by the Trustees of Indiana University */ static void dn_mult( register Index i_C, register Index i_A, register Index i_B) { if (outOfBounds(i_A) || outOfBounds(i_B)) {} else if (i_A >= offset) C_matrix[i_C-offset] += A_matrix[i_A-offset] * B_matrix[i_B-offset]; /* Both assertions about cache refer to extreme corners of */ /* the named quadrant. */ else { /* Precondition: one extreme block of C_ne, A_nw, or B_ne in cache. */ {{dn_mult( ne(i_C), nw(i_A), ne(i_B) ); /* Leaving C_ne_nw in cache. */ up_mult( ne(i_C), ne(i_A), se(i_B));} /* Leaving B_se_ne in cache. */ {dn_mult( se(i_C), se(i_A), se(i_B)); /* Leaving C_se_nw in cache. */ up_mult( se(i_C), sw(i_A), ne(i_B) );}} /* Leaving A_sw_nw in cache. */ {{up_mult( sw(i_C), sw(i_A), nw(i_B)); /* Leaving C_sw_nw in cache. */ dn_mult( sw(i_C), se(i_A), sw(i_B) );} /* Leaving B_sw_ne in cache. */ {up_mult( nw(i_C), ne(i_A), sw(i_B) ); /* Leaving C_nw_nw in cache. */ dn_mult( nw(i_C), nw(i_A), nw(i_B));}} /* Postcondition: extreme blocks of C_nw, A_nw, B_nw in cache. */ } } static void up_mult( register Index i_C, register Index i_A, register Index i_B) { if (outOfBounds(i_A) || outOfBounds(i_B)) {} else if (i_A >= offset) C_matrix[i_C-offset] += A_matrix[i_A-offset] * B_matrix[i_B-offset]; else { /* Precondition: one extreme block of C_nw,A_nw, or B_nw in cache. */ {{up_mult( nw(i_C), nw(i_A), nw(i_B)); /* Leaving C_nw_ne in cache. */ dn_mult( nw(i_C), ne(i_A), sw(i_B) );} /* Leaving B_sw_nw in cache. */ {up_mult( sw(i_C), se(i_A), sw(i_B) ); /* Leaving C_sw_ne in cache. */ dn_mult( sw(i_C), sw(i_A), nw(i_B));}} /* Leaving A_sw_nw in cache. */ {{dn_mult( se(i_C), sw(i_A), ne(i_B) ); /* Leaving C_se_nw in cache. */ up_mult( se(i_C), se(i_A), se(i_B));} /* Leaving B_se_ne in cache. */ {dn_mult( ne(i_C), ne(i_A), se(i_B)); /* Leaving C_ne_nw in cache. */ up_mult( ne(i_C), nw(i_A), ne(i_B) );}} /* Postcondition: extreme blocks of C_ne, A_nw, B_ne in cache. */ } }