Optimized matrix multiplication in C

后端 未结 13 2468
一整个雨季
一整个雨季 2020-11-30 01:44

I\'m trying to compare different methods for matrix multiplication. The first one is normal method:

do
{
    for (j = 0; j < i; j++)
    {
        for (k          


        
13条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-30 02:42

    How big improvements you get will depend on:

    1. The size of the cache
    2. The size of a cache line
    3. The degree of associativity of the cache

    For small matrix sizes and modern processors it's highly probable that the data fron both MatrixA and MatrixB will be kept nearly entirely in the cache after you touch it the first time.

提交回复
热议问题