Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Modify loop for faster execution

Hello,

Here's the code which works well for analysis while performing discrete wavelet transform. I've been wondering if this loop could be modified to make the execution faster? Any help would be appreciated.

int rows = signal.size();
int cols = signal[0].size();
int cols_lp1 =(int) ceil( (double) cols / 2);
vector<vector<double> > lp_dn1(rows, vector<double>( cols_lp1));

// Implementing row filtering and column downsampling in each branch.
for (int i =0; i < rows; i++) {
            vector<double> temp_row;
            for (int j=0;j <  cols;j++) {
                    double temp = signal[i][j];
                    temp_row.push_back(temp);
                   }
                    vector<double> oup;
                    branch_lp_dn(name,temp_row,oup);
                    temp_row.clear();

                    for (int j=0;j < (int) oup.size();j++) {
                    lp_dn1[i][j] = oup[j];
                    }
    }

Modify loop for faster execution

Hello,

Here's the code which works well for analysis while performing discrete wavelet transform. I've been wondering if this loop could be modified to make the execution faster? Any help would be appreciated.

int rows = signal.size();
int cols = signal[0].size();
int cols_lp1 =(int) ceil( (double) cols / 2);
vector<vector<double> > lp_dn1(rows, vector<double>( cols_lp1));

// Implementing row filtering and column downsampling in each branch.
for (int i =0; i < rows; i++) {
            vector<double> temp_row;
            for (int j=0;j <  cols;j++) {
                    double temp = signal[i][j];
                    temp_row.push_back(temp);
                   }
                    vector<double> oup;
                    branch_lp_dn(name,temp_row,oup);
                    temp_row.clear();

                    for (int j=0;j < (int) oup.size();j++) {
                    lp_dn1[i][j] = oup[j];
                    }
    }