From 226cd3b7fb9d79f3300d78695cbba9c32cc13c08 Mon Sep 17 00:00:00 2001 From: Orchisama Das Date: Sat, 23 Oct 2021 20:21:10 +0100 Subject: [PATCH] fixed slow implementation by vectorizing --- Source/CoupledMixingMatrix.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/CoupledMixingMatrix.cpp b/Source/CoupledMixingMatrix.cpp index 9011775..a266eef 100644 --- a/Source/CoupledMixingMatrix.cpp +++ b/Source/CoupledMixingMatrix.cpp @@ -64,15 +64,17 @@ void CoupledMixingMatrix::updateCouplingFilters(){ Eigen::VectorXf CoupledMixingMatrix::process(Eigen::VectorXf delayLineOutput){ Eigen::VectorXf delayLineInput(delayLineOutput.size()); - delayLineInput.setZero(); + //delayLineInput.setZero(); + delayLineInput = (M_block.cwiseProduct(couplingScalars)) * delayLineOutput; - for(int i = 0; i < nDelayLines; i++){ + //doing this in a loop is too slow and breaks things + /*for(int i = 0; i < nDelayLines; i++){ for(int j = 0; j < nDelayLines; j++){ if (!isFilter) - delayLineInput(i) += M_block(i,j)*couplingScalars(i,j)*delayLineOutput(i); + delayLineInput(i) += M_block(i,j)*couplingScalars(i,j)*delayLineOutput(j); } - } + }*/ return delayLineInput; }