Improve sensitivityCalc performance.
This commit is contained in:
@@ -133,6 +133,8 @@ Aurora::Matrix precalcSensitivityForTAS(const Aurora::Matrix &aMSensChar,
|
||||
const Aurora::Matrix &aMEndPositions) {
|
||||
auto sens = Aurora::zeros(aMEndPositions.getDimSize(1),
|
||||
aMStartPositions.getDimSize(1));
|
||||
//有修改,多线程化,可提升10倍速
|
||||
#pragma omp parallel for
|
||||
for (size_t i = 0; i < aMStartPositions.getDimSize(1); ++i) {
|
||||
auto dirVector = aMEndPositions -
|
||||
Aurora::repmat(aMStartPositions(Aurora::$, i).toMatrix(),
|
||||
@@ -160,23 +162,23 @@ combineSensitivity(const Aurora::Matrix &aVSenderTASRange,
|
||||
ret.emplace_back(Aurora::zeros(maxReceiverElementRange, maxReceiverTASRange,
|
||||
maxSenderElementRange));
|
||||
}
|
||||
size_t countSE = 0;
|
||||
//有修改,多线程化,可提升10倍速
|
||||
#pragma omp parallel for
|
||||
for (size_t i = 0; i < aVSenderTASRange.getDataSize(); i++) {
|
||||
auto se = aVReceiverTASRange.getData()[i];
|
||||
for (size_t j = 0; j < aVSenderElementRange.getDataSize(); j++) {
|
||||
auto sn = aVSenderElementRange.getData()[j];
|
||||
size_t countRE = 0;
|
||||
size_t countSE = i * aVSenderElementRange.getDataSize() + j;
|
||||
for (size_t k = 0; k < aVReceiverTASRange.getDataSize(); k++) {
|
||||
auto re = aVReceiverTASRange.getData()[k];
|
||||
for (size_t n = 0; n < aVReceiverElementRange.getDataSize(); n++) {
|
||||
size_t countRE = k*aVReceiverElementRange.getDataSize()+n;
|
||||
auto rn = aVReceiverElementRange.getData()[n];
|
||||
ret[se - 1](rn - 1, re - 1, sn - 1) =
|
||||
aMSenderSens(countRE, countSE).toMatrix().getScalar() *
|
||||
aMReceiverSens(countSE, countRE).toMatrix().getScalar();
|
||||
countRE++;
|
||||
}
|
||||
}
|
||||
countSE++;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user