Use omp to make getGeometryInfo speed up.
This commit is contained in:
@@ -34,12 +34,21 @@ Matrix loadSensitivity()
|
||||
Matrix y0 = linspace(-90,90,fullSens1D.getDataSize());
|
||||
Matrix x1 = linspace(-90,90,181);
|
||||
Matrix y1 = linspace(-90,90,181);
|
||||
Matrix y = repmat(Matrix::copyFromRawData(y1.getData(), 1),181,1);
|
||||
Matrix result = interpn(x0,y0,fullSens2D,x1,y,InterpnMethod::Linear);
|
||||
for(int i=1; i<181; ++i)
|
||||
//Matrix y = repmat(Matrix::copyFromRawData(y1.getData(), 1),181,1);
|
||||
double* resultData = new double[y1.getDataSize() * x1.getDataSize()];
|
||||
Matrix result = Matrix::fromRawData(resultData, y1.getDataSize(), x1.getDataSize());
|
||||
std::vector<Matrix> resultTemp(181);
|
||||
//Matrix result = interpn(x0,y0,fullSens2D,x1,y,InterpnMethod::Linear);
|
||||
#pragma omp parallel for
|
||||
for(int i=0; i<181; ++i)
|
||||
{
|
||||
y = repmat(Matrix::copyFromRawData(y1.getData() + i, 1),181,1);
|
||||
result = horzcat(result, interpn(x0,y0,fullSens2D,x1,y,InterpnMethod::Linear));
|
||||
Matrix y = repmat(Matrix::copyFromRawData(y1.getData() + i, 1),181,1);
|
||||
resultTemp[i]=interpn(x0,y0,fullSens2D,x1,y,InterpnMethod::Linear);
|
||||
}
|
||||
for(int i=0; i<181; ++i)
|
||||
{
|
||||
std::copy(resultTemp[i].getData(), resultTemp[i].getData() + resultTemp[i].getDataSize(), resultData);
|
||||
resultData += resultTemp[i].getDataSize();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user