本文整理汇总了C++中Timing::read方法的典型用法代码示例。如果您正苦于以下问题:C++ Timing::read方法的具体用法?C++ Timing::read怎么用?C++ Timing::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timing
的用法示例。
在下文中一共展示了Timing::read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
/******************************* [ signal ] ******************************/
Type a = 0;
Type b = Ls-1;
Vector<Type> t = linspace(a,b,Ls) / Type(Fs);
Vector<Type> s = sin( Type(400*PI) * pow(t,Type(2.0)) );
/******************************** [ widow ] ******************************/
a = 0;
b = Type(Lg-1);
Type u = (Lg-1)/Type(2);
Type r = Lg/Type(8);
t = linspace(a,b,Lg);
Vector<Type> g = gauss(t,u,r);
g = g/norm(g);
/********************************* [ WFT ] *******************************/
Type runtime = 0;
Timing cnt;
cout << "Taking windowed Fourier transform." << endl;
cnt.start();
Matrix< complex<Type> > coefs = wft( s, g );
cnt.stop();
runtime = cnt.read();
cout << "The running time = " << runtime << " (ms)" << endl << endl;
/******************************** [ IWFT ] *******************************/
cout << "Taking inverse windowed Fourier transform." << endl;
cnt.start();
Vector<Type> x = iwft( coefs, g );
cnt.stop();
runtime = cnt.read();
cout << "The running time = " << runtime << " (ms)" << endl << endl;
cout << "The relative error is : " << "norm(s-x) / norm(s) = "
<< norm(s-x)/norm(s) << endl << endl;
return 0;
}
示例2: main
int main()
{
/******************************* [ signal ] ******************************/
Vector<double> t = linspace( 0.0, (Ls-1)/fs, Ls );
Vector<double> st = sin( 200*PI*pow(t,2.0) );
st = st-mean(st);
/******************************** [ CWT ] ********************************/
Matrix< complex<double> > coefs;
CWT<double> wavelet("morlet");
wavelet.setScales( fs, fs/Ls, fs/2 );
Timing cnt;
double runtime = 0.0;
cout << "Taking continuous wavelet transform(Morlet)." << endl;
cnt.start();
coefs = wavelet.cwtC(st);
cnt.stop();
runtime = cnt.read();
cout << "The running time = " << runtime << " (ms)" << endl << endl;
/******************************** [ ICWT ] *******************************/
cout << "Taking inverse continuous wavelet transform." << endl;
cnt.start();
Vector<double> xt = wavelet.icwtC(coefs);
cnt.stop();
runtime = cnt.read();
cout << "The running time = " << runtime << " (ms)" << endl << endl;
cout << "The relative error is : " << endl;
cout << "norm(st-xt) / norm(st) = " << norm(st-xt)/norm(st) << endl;
cout << endl << endl;
/******************************* [ signal ] ******************************/
Vector<float> tf = linspace( float(0.0), (Ls-1)/float(fs), Ls );
Vector<float> stf = sin( float(200*PI) * pow(tf,float(2.0) ) );
stf = stf-mean(stf);
/******************************** [ CWT ] ********************************/
CWT<float> waveletf("mexiHat");
waveletf.setScales( float(fs), float(fs/Ls), float(fs/2), float(0.25) );
runtime = 0.0;
cout << "Taking continuous wavelet transform(Mexican Hat)." << endl;
cnt.start();
Matrix<float> coefsf = waveletf.cwtR(stf);
cnt.stop();
runtime = cnt.read();
cout << "The running time = " << runtime << " (ms)" << endl << endl;
/******************************** [ ICWT ] *******************************/
cout << "Taking inverse continuous wavelet transform." << endl;
cnt.start();
Vector<float> xtf = waveletf.icwtR(coefsf);
cnt.stop();
runtime = cnt.read();
cout << "The running time = " << runtime << " (ms)" << endl << endl;
cout << "The relative error is : " << endl;
cout << "norm(st-xt) / norm(st) = " << norm(stf-xtf)/norm(stf) << endl << endl;
return 0;
}