本文整理汇总了C++中vsip_csl::error_db方法的典型用法代码示例。如果您正苦于以下问题:C++ vsip_csl::error_db方法的具体用法?C++ vsip_csl::error_db怎么用?C++ vsip_csl::error_db使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vsip_csl
的用法示例。
在下文中一共展示了vsip_csl::error_db方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: input
void
test_fir(
vsip::length_type D,
vsip::length_type M,
vsip::length_type N)
{
const unsigned insize = 2 * M * N;
const unsigned outsize = ((2 * M * N) + D - 1) / D + 1;
vsip::Vector<T> input(insize);
vsip::Vector<T> output1(outsize);
vsip::Vector<T> output2(2 * M * (N+D-1)/D);
vsip::Vector<T> output3(2 * M * (N+D-1)/D);
vsip::Vector<T> convinput(insize+M, T(0)); // room for initial state
vsip::Vector<T> convout((insize+M-1)/D + 1, T(0)); // per spec
vsip::Vector<T> kernel(M);
for (vsip::length_type i = 0; i < insize; ++i)
input.put(i, T(i+1));
for (vsip::length_type i = 0; i < M; ++i)
kernel.put(i, T(2*i+1));
vsip::Convolution<vsip::const_Vector,sym,vsip::support_same,T,1> conv(
kernel, vsip::Domain<1>(convinput.size()), D);
const vsip::length_type pad = (sym == vsip::nonsym) ? M/2 :
(sym == vsip::sym_even_len_even) ? M : M - 1;
convinput(vsip::Domain<1>(pad, 1, insize)) = input;
conv(convinput, convout); // emulate chained FIR
vsip::Fir<> dummy(
vsip::const_Vector<>(vsip::length_type(3),vsip::scalar_f(1)), N*10);
test_assert(dummy.decimation() == 1);
vsip::Fir<T,sym,vsip::state_save,1> fir1a(kernel, N, D);
vsip::Fir<T,sym,vsip::state_save,1> fir1b(fir1a);
vsip::Fir<T,sym,vsip::state_no_save,1> fir2(kernel, N, D);
test_assert(fir1a.symmetry == sym);
test_assert(fir2.symmetry == sym);
test_assert(fir1a.continuous_filter == vsip::state_save);
test_assert(fir2.continuous_filter == vsip::state_no_save);
const vsip::length_type order = (sym == vsip::nonsym) ? M :
(sym == vsip::sym_even_len_even) ? 2 * M : (2 * M) - 1;
test_assert(fir1a.kernel_size() == order);
test_assert(fir1b.kernel_size() == order);
test_assert(fir1a.filter_order() == order);
test_assert(fir1b.filter_order() == order);
// test_assert(fir1a.symmetry()
test_assert(fir1a.input_size() == N);
test_assert(fir1b.input_size() == N);
test_assert(fir1a.output_size() == (N+D-1)/D);
test_assert(fir1b.output_size() == (N+D-1)/D);
test_assert(fir1a.continuous_filtering() == fir1a.continuous_filter);
test_assert(fir2.continuous_filtering() == fir2.continuous_filter);
test_assert(fir1a.decimation() == D);
test_assert(fir1b.decimation() == D);
vsip::length_type got1a = 0;
for (vsip::length_type i = 0; i < 2 * M; ++i) // chained
{
got1a += fir1a(
input(vsip::Domain<1>(i * N, 1, N)),
output1(vsip::Domain<1>(got1a, 1, (N + D - 1) / D)));
}
// vsip::Vector<T> o1(output1.size(), T(0));
// o1 = convout(vsip::Domain<1>(output1.size())) - output1;
vsip::length_type got1b = 0;
vsip::length_type got2 = 0;
for (vsip::length_type i = 0; i < 2 * M; ++i) // not
{
got1b += fir1b(input(vsip::Domain<1>(i * N, 1, N)),
output2(vsip::Domain<1>(got1b, 1, (N+D-1)/D)));
fir1b.reset();
got2 += fir2(input(vsip::Domain<1>(i * N, 1, N)),
output3(vsip::Domain<1>(got2, 1, (N+D-1)/D)));
}
vsip::Vector<T> reference(convout(vsip::Domain<1>(got1a)));
vsip::Vector<T> result(output1(vsip::Domain<1>(got1a)));
test_assert(outsize - got1a <= 1);
double error_rr = error_db(result, reference);
double error_23 = error_db(output2(vsip::Domain<1>(got1b)),
output3(vsip::Domain<1>(got1b)));
#if VERBOSE
using vsip::impl::Type_equal;
std::cout << "error_rr: " << error_rr
<< " error_23: " << error_23
<< " " << D << "/" << M << "/" << N
<< " "
<< (Type_equal<T, float>::value ? "float" :
Type_equal<T, double>::value ? "double" :
Type_equal<T, std::complex<float> >::value ? "complex<float>" :
Type_equal<T, std::complex<double> >::value ? "complex<double>" :
"*unknown*")
<< " " << (sym == vsip::sym_even_len_even ? "even" :
//.........这里部分代码省略.........