本文整理汇总了C++中AVector::rows方法的典型用法代码示例。如果您正苦于以下问题:C++ AVector::rows方法的具体用法?C++ AVector::rows怎么用?C++ AVector::rows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AVector
的用法示例。
在下文中一共展示了AVector::rows方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rcpp_model
//.........这里部分代码省略.........
// get the mode for beta given the mode of the approximated marginal posterior as z
// if TBF approach is used, this will be the only time the IWLS is used,
// because we only need the MLE and the Cholesky factor of its
// precision matrix estimate, which do not depend on z.
PosInt iwlsIterations = fitter.iwlsObject->startWithNewLinPred(40,
// this is the corresponding g
exp(startZ),
// and the start value for the linear predictor is taken from the Glm model config
config.linPredStart);
// echo debug-level message?
if(options.debug)
{
Rprintf("\ncpp_sampleGlm: Initial IWLS for high density point finished after %d iterations",
iwlsIterations);
}
// this is the current proposal info:
now.proposalInfo = fitter.iwlsObject->getResults();
// and this is the current parameters sample:
now.sample = Parameter(now.proposalInfo.coefs,
startZ);
if(options.tbf)
{
// we will not compute this in the TBF case:
now.logUnPosterior = R_NaReal;
// start to compute the variance of the intercept parameter:
// here the inverse cholesky factor of the precision matrix will
// be stored. First, it's the identity matrix.
AMatrix inverseQfactor = arma::eye(now.proposalInfo.qFactor.n_rows,
now.proposalInfo.qFactor.n_cols);
// do the inversion
trs(false,
false,
now.proposalInfo.qFactor,
inverseQfactor);
// now we can compute the variance of the intercept estimate:
const AVector firstCol = inverseQfactor.col(0);
const double interceptVar = arma::dot(firstCol, firstCol);
// ok, now alter the qFactor appropriately to reflect the
// independence assumption between the intercept estimate
// and the other coefficients estimates
now.proposalInfo.qFactor.col(0) = arma::zeros<AVector>(now.proposalInfo.qFactor.n_rows);
now.proposalInfo.qFactor(0, 0) = sqrt(1.0 / interceptVar);
}
else
{
// compute the (unnormalized) log posterior of the proposal
now.logUnPosterior = fitter.iwlsObject->computeLogUnPosteriorDens(now.sample);
}
}
else
{
PosInt coxfitIterations = fitter.coxfitObject->fit();
CoxfitResults coxResults = fitter.coxfitObject->finalizeAndGetResults();
fitter.coxfitObject->checkResults();
// echo debug-level message?
if(options.debug)