# Opencv matrix multiplication

Hi everybody,
i found that when i multiply vector in vector the run time is much more than when i multiply matrix in matrix in OpenCV 2.4.7
consider that both of the vector and matrices has the same number of multiplication.
for example:

`````` cv::Mat mat1(186, 186, CV_64FC1, cv::Scalar::all(20.));
cv::Mat vec1(186, 1, CV_64FC1, cv::Scalar::all(20.));
cv::Mat vec1_tr(1, 186, CV_64FC1, cv::Scalar::all(20.));
int64_t matrix_time{ 0 };
for (int i = 0; i < m_loop_count; ++i)
{
tick_tock mat_tick;
mat_tick.tick();
cv::Mat out = (vec1_tr * mat1) * vec1;
//  34782 multiplication
matrix_time += mat_tick.tock();
}
int mul_count = (186* 186) + 186; //34782
cv::Mat mat2(mul_count, 1, CV_64FC1, cv::Scalar::all(20.));
cv::Mat mat2_tr(1, mul_count, CV_64FC1, cv::Scalar::all(20.));

int64_t vec_time{ 0 };
for (int i = 0; i < m_loop_count ; ++i)
{
tick_tock vec_tick;
vec_tick.tick();
cv::Mat out = mat2_tr * mat2;//34782 multiplication
vec_time += vec_tick.tock();
}
``````

the matrix multiplication is much faster (2 times) than vector but both has 34782 multiplication.
can anybody explain why?
thank you.

that died years ago.
please throw it away, and update to recent 4.5.x (no discussion)