void dswapVector3(sparseVector *sparse1, sparseVector *sparse2, int indexStart, int indexEnd) { REAL *dense1, *dense2; if(indexStart<=0) indexStart = 1; if(indexEnd<=0) indexEnd = MAX(lastIndex(sparse1), lastIndex(sparse2)); if(indexStart <= firstIndex(sparse1) && indexStart <= firstIndex(sparse2) && indexEnd >= lastIndex(sparse1) && indexEnd >= lastIndex(sparse2)) { swapVector(sparse1, sparse2); } else { CALLOC(dense1, (indexEnd+1)); CALLOC(dense2, (indexEnd+1)); getVector(sparse1, dense1, indexStart, indexEnd, TRUE); getVector(sparse2, dense2, indexStart, indexEnd, TRUE); clearVector(sparse1, indexStart, indexEnd); clearVector(sparse2, indexStart, indexEnd); putVector(sparse1, dense2, indexStart, indexEnd); putVector(sparse2, dense1, indexStart, indexEnd); MEMFREE(dense1); MEMFREE(dense2); } }
void SignalProcessTools::plot(vector dataX, vector dataY, \ string title, string xLabel, string yLabel) { putVector(dataX, "X"); putVector(dataY, "Y"); engEvalString(ep, "plot(X,Y);"); if (title != "") engEvalString(ep, ("title('"+title+"');").c_str()); if (xLabel != "") engEvalString(ep, ("xlabel('"+xLabel+"');").c_str()); if (yLabel != "") engEvalString(ep, ("ylabel('"+yLabel+"');").c_str()); }
void SignalProcessTools::putWaveData(WaveData data) { putVector(data.wave, "W"); mxArray *Fs; Fs = mxCreateDoubleScalar(data.sampleRate); engPutVariable(ep, "Fs", Fs); }
void daxpyVector2(REAL *dense, REAL scalar, sparseVector *sparse, int indexStart, int indexEnd) { sparseVector *hold; hold = createVector(sparse->limit, sparse->count); putDiagonalIndex(hold, getDiagonalIndex(sparse)); putVector(hold, dense, indexStart, indexEnd); daxpyVector3(hold, scalar, sparse, indexStart, indexEnd); freeVector(hold); }
void SignalProcessTools::plot(vector dataX) { putVector(dataX, "X"); engEvalString(ep, "plot(X);"); }