Skip to content

Instantly share code, notes, and snippets.

@kalda341
Created October 6, 2015 07:46
Show Gist options
  • Save kalda341/61da8d28691a947f08a7 to your computer and use it in GitHub Desktop.
Save kalda341/61da8d28691a947f08a7 to your computer and use it in GitHub Desktop.
for (bi=0; bi<size; bi+=block_size){
for (bj=0; bj<size; bj+=block_size){
//Handle cases where size%block_size!=0
max_j = (bi+block_size<=size)?block_size:size%block_size;
max_k = (bj+block_size<=size)?block_size:size%block_size;
for (i=0; i<block_size; i++){
for (j=0; j<max_j; j++){
for (k=0; k<max_k; k++){
result[i*size+(bi+j)] += A[i*size+(bj+k)] * B[(bj+k)*size+(bi+j)];
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment