本文整理汇总了C++中rcpp::NumericMatrix::end方法的典型用法代码示例。如果您正苦于以下问题:C++ NumericMatrix::end方法的具体用法?C++ NumericMatrix::end怎么用?C++ NumericMatrix::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rcpp::NumericMatrix
的用法示例。
在下文中一共展示了NumericMatrix::end方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: solveCoef
double sPredModule::solveCoef(double wrss) {
Rcpp::NumericMatrix
cc = d_fac.solve(CHOLMOD_L, d_fac.solve(CHOLMOD_P, d_Vtr));
double ans = sqrt(inner_product(cc.begin(), cc.end(),
cc.begin(), double())/wrss);
Rcpp::NumericMatrix
bb = d_fac.solve(CHOLMOD_Pt, d_fac.solve(CHOLMOD_Lt, cc));
copy(bb.begin(), bb.end(), d_coef.begin());
return ans;
}
示例2: eigs_sym_shift_c
void eigs_sym_shift_c(
mat_op op, int n, int k, double sigma,
const spectra_opts *opts, void *data,
int *nconv, int *niter, int *nops,
double *evals, double *evecs, int *info
)
{
BEGIN_RCPP
CRealShift cmat_op(op, n, data);
Rcpp::List res;
try {
res = run_eigs_shift_sym((RealShift*) &cmat_op, n, k, opts->ncv, opts->rule,
sigma, opts->maxitr, opts->tol, opts->retvec != 0);
*info = 0;
} catch(...) {
*info = 1; // indicates error
}
*nconv = Rcpp::as<int>(res["nconv"]);
*niter = Rcpp::as<int>(res["niter"]);
*nops = Rcpp::as<int>(res["nops"]);
Rcpp::NumericVector val = res["values"];
std::copy(val.begin(), val.end(), evals);
if(opts->retvec != 0)
{
Rcpp::NumericMatrix vec = res["vectors"];
std::copy(vec.begin(), vec.end(), evecs);
}
VOID_END_RCPP
}
示例3: rthxpos
RcppExport SEXP rthxpos(SEXP m)
{
Rcpp::NumericMatrix tmpm = Rcpp::NumericMatrix(m);
int nr = tmpm.nrow();
int nc = tmpm.ncol();
thrust::device_vector<double> dmat(tmpm.begin(),tmpm.end());
// make space for the transpose
thrust::device_vector<double> dxp(nr*nc);
// iterator to march through the matrix elements
thrust::counting_iterator<int> seqb(0);
thrust::counting_iterator<int> seqe = seqb + nr*nc;
// for each i in seq, copy the matrix elt to its spot in the
// transpose
thrust::for_each(seqb,seqe,
copyelt2xp(dmat.begin(),dxp.begin(),nr,nc));
// prepare the R output, and return it
Rcpp::NumericVector routmat(nc*nr);
thrust::copy(dxp.begin(),dxp.end(),routmat.begin());
return routmat;
}