本文整理汇总了C++中cvec类的典型用法代码示例。如果您正苦于以下问题:C++ cvec类的具体用法?C++ cvec怎么用?C++ cvec使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了cvec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prePost
cvec prePost (cvec data_time, int pre, int post){
data_time.ins(0, data_time.right(pre));
data_time.ins(data_time.length(), data_time.mid(pre,post));
return(data_time);
}
示例2: miso_out
ivec Ant1Relay::bpsk_nc_ml_demapping(Array<complex<double> > &miso_out, cvec symbols) {
ivec res_label;
res_label.set_size(miso_out.size());
for(int i=0; i<miso_out.size(); i++) {
complex<double> Y = miso_out(i);
cvec X = zeros_c(2);
double min_norm = numeric_limits<double>::max();
int min_pt = -1;
for(int q=0; q<symbols.size(); q++) {
X(0) = symbols(q);
for(int r=0; r<symbols.size(); r++) {
X(1) = symbols(r);
complex<double> hx = channel * X;
double calc_norm = norm(Y-hx);
if(calc_norm < min_norm) {
min_norm = calc_norm;
min_pt = (q^r) & 0x01; // xor
}
}
}
res_label(i) = min_pt;
}
return res_label;
}
示例3: roots
void roots(const vec &p, cvec &r)
{
int n = p.size(), m, l;
ivec f = find(p != 0.0);
m = f.size();
vec v = p;
mat A;
if (m > 0 && n > 1) {
v = v(f(0), f(m - 1));
l = v.size();
if (l > 1) {
A = diag(ones(l - 2), -1);
A.set_row(0, -v(1, l - 1) / v(0));
r = eig(A);
cvec d;
cmat V;
eig(A, d , V);
if (f(m - 1) < n)
r = concat(r, zeros_c(n - f(m - 1) - 1));
}
else {
r.set_size(n - f(m - 1) - 1, false);
r.zeros();
}
}
else
r.set_size(0, false);
}
示例4: process
cvec fir_x::process(bvec ce, cvec x)
{
cvec y;
int N;
#if (DEBUG_LEVEL==3)
cout << "***** fir_x::proc *****" << endl;
cout << "ce=" << ce << endl;
cout << "x=" << x << endl;
sleep(1000);
#endif
N=ce.length();
if (x.length()!=N) {
throw sci_exception("fir_x::process - ce.size <> x.size", x.length() );
}
y.set_size(N);
for (int i=0; i<N; i++) {
if (bool(ce[i])) y0=update(x[i]);
y[i]=y0;
}
#if (DEBUG_LEVEL==3)
cout << "y=" << y << endl;
cout << "+++++ fir_x::proc +++++" << endl;
sleep(1000);
#endif
return (y);
}
示例5: assert_cvec
static
void assert_cvec(const cvec &ref, const cvec &act)
{
ASSERT_EQ(ref.length(), act.length());
for (int n = 0; n < ref.length(); ++n) {
ASSERT_NEAR(ref[n].real(), act[n].real(), tol);
ASSERT_NEAR(ref[n].imag(), act[n].imag(), tol);
}
}
示例6: assert_cvec_p
static
void assert_cvec_p(const cvec &ref, const cvec &act, int line)
{
ASSERT_EQ(ref.length(), act.length()) << line;
for (int n = 0; n < ref.length(); ++n) {
ASSERT_NEAR(ref(n).real(), act(n).real(), tol) << line;
ASSERT_NEAR(ref(n).imag(), act(n).imag(), tol) << line;
}
}
示例7: it_assert_debug
cvec operator/(const cvec &v, const double &s)
{
it_assert_debug(v.size() > 0, "operator/(): Vector of zero length");
cvec temp = v;
for (int i = 0;i < v.size();i++) {
temp(i) /= (double)s;
}
return temp;
}
示例8: zero_pad_back
void zero_pad_back(cvec& vec_in, int m_in)
{
int quotient = vec_in.length() / m_in;
if (quotient*m_in == vec_in.length()) {
return;
}
else {
int n_remainder = (quotient + 1) * m_in - vec_in.length();
vec_in = concat(vec_in, zeros_c(n_remainder));
}
}
示例9: descrambling
cvec descrambling(cvec data,cvec code)
{
cvec result;
result.set_length(data.length());
result.zeros();
for(int i=0;i<data.length();i++)
{
result[i]=data(i)*code(i);
}
return result;
}
示例10: poly
void poly(const cvec &r, cvec &p)
{
int n = r.size();
p.set_size(n + 1, false);
p.zeros();
p(0) = 1.0;
for (int i = 0; i < n; i++)
p.set_subvector(1, p(1, i + 1) - r(i)*p(0, i));
}
示例11: auto_correlation
void auto_correlation(const cvec &a, cvec &x)
{
int k = a.size();
x.set_size(k);
for (int i = 0; i < k; ++i) {
x[i] = 0;
for (int j = 0; j < k - i; ++j)
x[i] += a[j] * conj(a[j + i]);
for (int j = k - i; j < k; ++j)
x[i] += a[j] * conj(a[j - k + i]);
}
}
示例12: it_assert_debug
cvec operator*(const cmat &m, const cvec &v)
{
it_assert_debug(m.no_cols == v.size(), "cmat::operator*(): Wrong sizes");
cvec r(m.no_rows);
std::complex<double> alpha = std::complex<double>(1.0);
std::complex<double> beta = std::complex<double>(0.0);
char trans = 'n';
int incr = 1;
blas::zgemv_(&trans, &m.no_rows, &m.no_cols, &alpha, m.data, &m.no_rows,
v._data(), &incr, &beta, r._data(), &incr);
return r;
}
示例13: set_state
void fir_x::set_state(cvec cv)
{
int k,N;
N=get_size();
if (cv.length()!=N ) {
throw sci_exception("fir::set_state v.lenght <> fir_size", cv.length() );
}
for (k=0; k < N; k++) {
z[k]=cv[k];
}
}
示例14: Plot_data
void Plot::Plot_data(cvec ydata, int plot_number){
double x[ydata.length()];
double y[ydata.length()];
if(plot_number==2){
curve2.setStyle(QwtPlotCurve::CurveStyle(4));
for (int i=0;i<ydata.length();i++){
x[i]=real(ydata.get(i));
y[i]=imag(ydata.get(i));
}
curve2.setData(x,y,ydata.length());
gui->qwtPlot_2->replot();
}
}
示例15: polyval
cvec polyval(const cvec &p, const vec &x)
{
it_error_if(p.size() == 0, "polyval: size of polynomial is zero");
it_error_if(x.size() == 0, "polyval: size of input value vector is zero");
cvec out(x.size());
out = p(0);
for (int i = 1; i < p.size(); i++)
out = std::complex<double>(p(i)) + elem_mult(to_cvec(x), out);
return out;
}