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 320×1 column vector by a 390×320 matrix, then multiplication by a 72000×390 matrix. Time : ~35 ms.
Operation 1b is : 10 times the multiplication of a 32×1 column vector by a 390×32 matrix, then multiplication by a 7200×390 matrix. Time : ~35 ms
Operation 2 is: multiplication of a 320×1 column vector by a 72000×320 matrix. Time : ~30 ms.
Operation 2b is : 10 times the multiplication of a 32×1 column vector by a 7200×32 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 cannot 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 and 1b require the same amount of multiplication, but Operation 2 requires 10X the multiplication of Operation 2b.