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


C++ MatrixXf::rowwise方法代码示例

本文整理汇总了C++中eigen::MatrixXf::rowwise方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixXf::rowwise方法的具体用法?C++ MatrixXf::rowwise怎么用?C++ MatrixXf::rowwise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eigen::MatrixXf的用法示例。


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

示例1: plotNodesAsSpheres

//Standard
void plotNodesAsSpheres(const Eigen::MatrixXf centers, const Eigen::MatrixXf colors, const Eigen::VectorXf& pVis, const Eigen::MatrixXf& stdev, PlotSpheres::Ptr spheres) {
	int K = centers.rows();
	assert(centers.cols() == 3);
	assert(colors.rows() == K);
	assert(colors.cols() == 3);
	assert(pVis.size() == K);
	assert(stdev.rows() == K);

	MatrixXf rgba(colors.rows(), 4);
	rgba << colors.rowwise().reverse(), pVis;
	VectorXf sizes = stdev.rowwise().mean()/4.0;
	spheres->plot(util::toVec3Array(centers), util::toVec4Array(rgba), toVec(sizes));
}
开发者ID:NaohiroHayashi,项目名称:bulletsim,代码行数:14,代码来源:plotting_tracking.cpp

示例2: run

int run() {
    // store cooccurrence in Eigen sparse matrix object
    REDSVD::SMatrixXf A;
    const int ncontext = read_cooccurrence(c_cooc_file_name, A, verbose);

    // read U matrix from file
    Eigen::MatrixXf V;
    read_eigen_truncated_matrix(c_input_file_V_name, V, dim);
    // read S matrix from file
    Eigen::VectorXf S;
    read_eigen_vector(c_input_file_S_name, S, dim, 1.0-eig);

    // checking the dimensions
    if (V.rows() != ncontext){
        throw std::runtime_error("size mismatch between projection V matrix and the number of context words!!");
    }

    // starting projection
    if (verbose) fprintf(stderr, "Running the projection...");
    const double start = REDSVD::Util::getSec();
    Eigen::MatrixXf embeddings = A * V * S.asDiagonal().inverse();
    if (norm) embeddings.rowwise().normalize();
    if (verbose) fprintf(stderr, "done in %.2f.\n",REDSVD::Util::getSec() - start);

    // write out embeddings
    const char *c_output_name = get_full_path(c_cooc_dir_name, c_output_file_name);
    if (verbose) fprintf(stderr, "writing infered word embeddings in %s\n", c_output_name);
    write_eigen_matrix(c_output_name, embeddings);
    free((char*)c_output_name);

    return 0;
}
开发者ID:rlebret,项目名称:hpca,代码行数:32,代码来源:inference.cpp

示例3: getnn

/* return word nearest neighbors in the embedding space */
void getnn(FILE* fout, Eigen::MatrixXf m, const int idx){
    // find nearest neighbour
    Eigen::VectorXf dist = (m.rowwise() - m.row(idx)).rowwise().squaredNorm();
    std::vector<int> sortidx = REDSVD::Util::ascending_order(dist);
    for (int i=1;i<top;i++){
        fprintf(fout, "%s, ", tokename[sortidx[i]]);
    }
    fprintf(fout, "%s\n", tokename[sortidx[top]]);
}
开发者ID:rlebret,项目名称:hpca,代码行数:10,代码来源:neighbors.cpp

示例4: histAB

float
computeHistogramIntersection (const Eigen::VectorXf &histA, const Eigen::VectorXf &histB)
{
    Eigen::MatrixXf histAB (histA.rows(), 2);
    histAB.col(0) = histA;
    histAB.col(1) = histB;

    Eigen::VectorXf minv = histAB.rowwise().minCoeff();
    return minv.sum();
}
开发者ID:Cerarus,项目名称:v4r,代码行数:10,代码来源:miscellaneous.hpp

示例5: calcMeanAndCovarWeighedVectorized

	void calcMeanAndCovarWeighedVectorized(const Eigen::MatrixXf &input, const Eigen::VectorXd &inputWeights, Eigen::MatrixXf &out_covMat, Eigen::VectorXf &out_mean,Eigen::MatrixXf &temp)
	{
		out_mean=input.col(0); //to resize
		out_mean.setZero();
		double wSumInv=1.0/inputWeights.sum();
		for (int k=0;k<inputWeights.size();k++){
			double w=inputWeights[k];
			out_mean+=input.col(k)*(float)(w*wSumInv);
		}
		out_mean = input.rowwise().mean();
		temp = (input.colwise() - out_mean);
		for (int k=0;k<inputWeights.size();k++){
			temp.col(k) *= (float)(sqrt(inputWeights(k)*wSumInv));	//using square roots, as we only want the normalized weights to be included once for each result element in the multiplication below
		}
		out_covMat = temp*temp.transpose();
	}
开发者ID:radioactive1014,项目名称:Kuka_lab,代码行数:16,代码来源:EigenMathUtils.cpp

示例6: TestCovariate

  int TestCovariate(Matrix& Xnull, Matrix& Y, Matrix& Xcol,
                    const EigenMatrix& kinshipU, const EigenMatrix& kinshipS){
    Eigen::MatrixXf g;
    G_to_Eigen(Xcol, &g);

    // store U'*G for computing AF later.
    const Eigen::MatrixXf& U = kinshipU.mat;
    this->ug = U.transpose() * g;

    Eigen::RowVectorXf g_mean = g.colwise().mean();
    g = g.rowwise() - g_mean;

    double gTg = g.array().square().sum();
    double t_new = (g.array() * this->transformedY.array()).sum();
    t_new = t_new * t_new / gTg;
    double t_score = t_new / this->gamma;
    this->betaG = (g.transpose() * this->transformedY).sum() / gTg / this->gamma;
    this->betaGVar = this->ySigmaY / gTg / this->gamma;

    this->pvalue = gsl_cdf_chisq_Q(t_score, 1.0);
    return 0;
  }
开发者ID:hjanime,项目名称:rvtests,代码行数:22,代码来源:GrammarGamma.cpp

示例7: centerMatrix

Eigen::MatrixXf centerMatrix(const Eigen::MatrixXf& x) {
  return x.rowwise() - x.colwise().mean();
}
开发者ID:vschulz,项目名称:rvtests,代码行数:3,代码来源:KinshipHolder.cpp


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