当前位置: 首页>>代码示例>>C++>>正文


C++ Array1D类代码示例

本文整理汇总了C++中Array1D的典型用法代码示例。如果您正苦于以下问题:C++ Array1D类的具体用法?C++ Array1D怎么用?C++ Array1D使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Array1D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SegmentDataByIDX

vector<Mat> SegmentDataByIDX(const Mat& data, const Mat& idx)
{
    assert(data.type() == CV_32F || data.type() == CV_64F);
    assert(data.rows > 0 && data.cols > 0 && idx.rows > 0 && idx.cols > 0);
    assert(data.cols == idx.cols);
    Array2D idx_hash;
    if (idx.type() != CV_32S) {
        Mat idx_tmp = idx;
        Mat_<int> tmp;
        idx_tmp.convertTo(tmp, CV_32S);
        idx_hash = ComputeIDX(tmp);
    } else{
        idx_hash = ComputeIDX(idx);
    }
    if (idx_hash.empty()) { return vector<Mat>(); }
    vector<Mat> result(idx_hash.size());
    for (int i = 0; i < idx_hash.size(); i++) {
        Array1D cur = idx_hash[i];
        if (cur.empty()) { return vector<Mat>(); }
        Mat temp(data.rows, cur.size(), data.type());
        Mat col(data.rows, 1, data.type());
        for (int j = 0; j < cur.size(); j++) {
            col = temp(Range(0, data.rows), Range(j, j + 1));
            data(Range(0, data.rows), Range(cur[j] - 1, cur[j])).copyTo(col);
        }
        result[i] = temp;
    }
    return result;
}
开发者ID:xiejianhe,项目名称:SPDA,代码行数:29,代码来源:segment_data_by_idx.cpp

示例2: parentIndex

BayesNetwork::BayesNetwork(Array1D<Discretizer*> &discretizers)
  : parentIndex(discretizers.size()),
    probTables(discretizers.size()),
    discretizers(discretizers)
{
  parentIndex.setAllTo(-1);
}
开发者ID:bmajoros,项目名称:BioMaLL,代码行数:7,代码来源:BayesNetwork.C

示例3: CombinationWithDuplicatedElementsByNonRecursion

Array2D CombinationWithDuplicatedElementsByNonRecursion(Array1D array, int K)
{
    Array2D result;
    if (array.empty() || K <= 0) { return result; }
    if (array.size() < K) {
        result.push_back(array);  /** @warning maybe exclude it */
        return result;
    }

    std::sort(array.begin(), array.end());
    result.push_back(Array1D());
    int last = array[0], opt_result_num = 1;
    for (int i = 0; i < array.size(); i++) {
        if (array[i] != last) {
            last = array[i];
            opt_result_num = result.size();
        }
        Array2D::size_type result_size = result.size();
        for (int j = result_size - 1; j >= result_size - opt_result_num; j--) {
            result.push_back(result[j]);
            result.back().push_back(array[i]);
        }
    }
    return result;
}
开发者ID:xiejianhe,项目名称:FindWork,代码行数:25,代码来源:combination.cpp

示例4: py_glDrawBuffers

static PyObject* py_glDrawBuffers(PyObject *, PyObject *args) {
  CHECK_ARG_COUNT(args, 1);
  Array1D<Enum> buffers;
  if (buffers.fromPy(PyTuple_GetItem(args, 0))) {
    glDrawBuffers(buffers.size(), buffers);
  }
  Py_RETURN_NONE;
}
开发者ID:gatgui,项目名称:pygl,代码行数:8,代码来源:gl_2_0.cpp

示例5: upsample

void upsample(const Array1D<T>& v, int usf, Array1D<T>& u)
{
  //  it_assert1(usf >= 1, "upsample: upsampling factor must be equal or greater than one" );
  u.set_size(v.length()*usf);
  u.clear();
  for(long i=0;i<v.length();i++)
    u(i*usf)=v(i); 
}
开发者ID:mbillingr,项目名称:tools4bci-unibuild,代码行数:8,代码来源:array1d_functions.cpp

示例6: apply_function

Array1D<T> apply_function(fT (*f)(fT), const Array1D<T>& data)
{
    Array1D<T> out(data.length());
  
    for (int i=0;i<data.length();i++) 
	out[i]=static_cast<T>(f(static_cast<fT>(data[i])));
    return out;
}
开发者ID:mbillingr,项目名称:tools4bci-unibuild,代码行数:8,代码来源:array1d_functions.cpp

示例7: adjust_quant_indices

const Array1D adjust_quant_indices(const Array1D& qIndices, const int qMatrix) {
  Array1D aQIndices(qIndices.ranges());
  // Adjust all the quantisers in qIndices
  std::transform(qIndices.data(), qIndices.data()+qIndices.num_elements(),
                 aQIndices.data(),
                 std::bind2nd(std::ptr_fun(adjust_quant_index), qMatrix) );
  return aQIndices;
}
开发者ID:GrokImageCompression,项目名称:vc2-reference,代码行数:8,代码来源:Quantisation.cpp

示例8: assign_mat_ar1d

void assign_mat_ar1d(Matrix& m, const Array1D< double >& a)
{
	m.NewMatrix(1, a.dim());
	Matrix::r_iterator p_m(m.begin());
	for(long i = 0; i < a.dim(); ++i) {
		*p_m = a[i];
		++p_m;
	}
}
开发者ID:uentity,项目名称:smadopt,代码行数:9,代码来源:m_algorithm.cpp

示例9: py_glShaderSource

static PyObject* py_glShaderSource(PyObject *, PyObject *args) {
  CHECK_ARG_COUNT(args, 2);
  Uint shader(PyTuple_GetItem(args, 0));
  Array1D<String> strings;
  if (strings.fromPy(PyTuple_GetItem(args, 1))) {
    glShaderSource(shader, strings.size(), strings, 0);
  }
  Py_RETURN_NONE;
}
开发者ID:gatgui,项目名称:pygl,代码行数:9,代码来源:gl_2_0.cpp

示例10: zero_pad

Array1D<T> zero_pad(const Array1D<T>& v, int n)
{
    it_assert(n>=v.size(), "zero_pad() cannot shrink the vector!");
    Array1D<T> v2(n);
    v2.set_subvector(0, v.size()-1, v);
    if (n > v.size())
	v2.set_subvector(v.size(), n-1, T(0));

    return v2;
}
开发者ID:mbillingr,项目名称:tools4bci-unibuild,代码行数:10,代码来源:array1d_functions.cpp

示例11: repeat

Array1D<T> repeat(const Array1D<T>& v, int norepeats)
{
    Array1D<T> temp(v.length()*norepeats);
  
    for(int i=0;i<v.length();i++) {
	for(int j=0;j<norepeats;j++)
	    temp(i*norepeats+j)=v(i);
    }
    return temp;
}
开发者ID:mbillingr,项目名称:tools4bci-unibuild,代码行数:10,代码来源:array1d_functions.cpp

示例12: lininterp

void lininterp(const Array1D<T>& v, int usf, Array1D<T>& u)
{
  //  it_assert1(usf >= 1, "lininterp: upsampling factor must be equal or greater than one" );
  long L = (v.length()-1)*usf+1;
  u.set_size(L);
  for (long j = 0; j < L-1; j++) {
    //u(j) = (v(j/usf) + (j % usf)/((float)usf)*(v((j+usf)/usf)-v(j/usf)));  
    u(j) = (v(j/usf) + (j % usf)/((double)usf)*(v((j+usf)/usf)-v(j/usf)));  
  }
  u(L-1) = v(v.length()-1);
}
开发者ID:mbillingr,项目名称:tools4bci-unibuild,代码行数:11,代码来源:array1d_functions.cpp

示例13: evaluate

 void
 CDFBasis<d,dt>::evaluate
 (const unsigned int derivative,
  const RIndex& lambda,
  const Array1D<double>& points, Array1D<double>& values)
 {
   values.resize(points.size());
   for (unsigned int i(0); i < values.size(); i++) {
     values[i] = evaluate(derivative, lambda, points[i]);
   }
 }
开发者ID:kedingagnumerikunimarburg,项目名称:Marburg_Software_Library,代码行数:11,代码来源:cdf_basis.cpp

示例14: inverse_quantise_transform_np

const Array2D inverse_quantise_transform_np(const Array2D& qCoeffs,
                                            const Array2D& qIndices,
                                            const Array1D& qMatrix) {
  // TO DO: Check numberOfSubbands=3n+1 ?
  BlockVector aQIndices(qMatrix.ranges());
  const int numberOfSubbands = qMatrix.size();
  for (char band=0; band<numberOfSubbands; ++band) {
    aQIndices[band] = adjust_quant_indices(qIndices, qMatrix[band]);
  }
  return inverse_quantise_subbands_np(qCoeffs, aQIndices);
}
开发者ID:GrokImageCompression,项目名称:vc2-reference,代码行数:11,代码来源:Quantisation.cpp

示例15: CombinationByDecrease

Array2D CombinationByDecrease(Array1D array, int K)
{
    Array2D result;
    if (array.empty() || K <= 0) { return result; }
    if (array.size() < K) {
        result.push_back(array);  /** @warning maybe exclude it */
        return result;
    }
    Array1D temp(K);
    CombinationByDecreaseHelper(array, array.size(), K, temp, result);
}
开发者ID:xiejianhe,项目名称:FindWork,代码行数:11,代码来源:combination.cpp


注:本文中的Array1D类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。