Faster way to do multi dimensional matrix addition?

前端 未结 2 2073
生来不讨喜
生来不讨喜 2021-01-27 05:41

I have a matrix A of size (m * l * 4) and size of m is around 100,000 and l=100. size of list is always equal to n and n <=m. I wanted to do matrix addition of given list of

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-27 06:01

    Exchange loop by i and loop by j in the second part. This will make the function more cache-friendly.

    for(int j=0;j

    Also, I hope you did not forget -O3 flag.

提交回复
热议问题