Why is MATLAB so fast in matrix multiplication?

前端 未结 12 1113
無奈伤痛
無奈伤痛 2020-11-22 00:29

I am making some benchmarks with CUDA, C++, C#, Java, and using MATLAB for verification and matrix generation. When I perform matrix multiplication with MATLAB, 2048x

12条回答
  •  礼貌的吻别
    2020-11-22 00:50

    This is why. MATLAB doesn't perform a naive matrix multiplication by looping over every single element the way you did in your C++ code.

    Of course I'm assuming that you just used C=A*B instead of writing a multiplication function yourself.

提交回复
热议问题