开发者

Helping me understand these computation time

I am doing several matrix computations on OpenCV and I cannot understand why it takes the time it takes

Operation 1 is : multiplication of a 320x1 column vector by a 390x320 matrix, then multiplication by a 72000x390 matrix. Time : ~35 ms. Operation 1b is : 10 times the multiplication of a 32x1 column vector by a 390x32 matrix, then multiplication by a 7200x390 matrix. Time : ~35 ms

Operation 2 is: multiplication of a 320x1 column vector by a 72000x320 matrix. Time : ~30 ms. Operation 2b is : 10 times the multiplication of a 32x1 column vector by a 7200x32 matrix. Time : ~10 ms

Basically in Operations 1 I am always using an intermediate column vector of size 390, while I skip this in Operations 2. Yet I cann开发者_如何学Goot explain why the operation 2b is much faster than 2, when 1b and 1 are the same speed.

Any ideas? Thanks


Looking at the number of multiplications to be performed by each operation, I see:

Operation 1: 390 * 320 = 124,800
Operation 1b: 10 *390 * 32 = 124,800
Operation 2: 72000 * 320 = 23,040,000
Operation 2b: 10 * 7200 * 32 = 2,304,000

Operation 1 and 1b require the same amount of multiplication, but Operation 2 requires 10X the multiplication of Operation 2b.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜