# Dynamic size double matrix to matrix product problem when multithreading is on

## Submitted by Sobhan Naderi

Assigned to **Nobody**

**Link to original bugzilla bug (#714)**

**Operating system**: Linux

## Description

I was working with dynamic size double matrices and I was compiling with openMP. I set the matrices by mapping their data array as follows:

Map<Matrix<double, Dynamic, Dynamic, RowMajor> > feature_matrix(ht, cnt_features, cnt_feature_dim);

Map<Matrix<double, Dynamic, Dynamic, ColMajor> > filter_matrix(filters + offset, cnt_feature_dim, cnt_filters);

Then I computed the product of the two matrices as follows:

MatrixXd* response = new MatrixXd(cnt_features, cnt_filters);

response->noalias() = feature_matrix * filter_matrix;

It sometimes happened so that the value of the entry (i, j) in the "response" matrix did not match with the dot product of the i-th row of feature_matrix and j-th column of filter_matrix. Weird!

Then I realized that the problem stems from a call to "omp_set_dynamic(1)" that I had in my code. If I remove that line the code seems to run just fine.

Sobhan