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


C++ SpdMatrix::logdet方法代码示例

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


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

示例1: log_model_prob

  double BLSSS::log_model_prob(const Selector &g)const{
    // borrowed from MLVS.cpp
    double num = vpri_->logp(g);
    if(num==BOOM::negative_infinity() || g.nvars() == 0) {
      // If num == -infinity then it is in a zero support point in the
      // prior.  If g.nvars()==0 then all coefficients are zero
      // because of the point mass.  The only entries remaining in the
      // likelihood are sums of squares of y[i] that are independent
      // of g.  They need to be omitted here because they are omitted
      // in the non-empty case below.
      return num;
    }
    SpdMatrix ivar = g.select(pri_->siginv());
    num += .5*ivar.logdet();
    if(num == BOOM::negative_infinity()) return num;

    Vector mu = g.select(pri_->mu());
    Vector ivar_mu = ivar * mu;
    num -= .5*mu.dot(ivar_mu);

    bool ok=true;
    ivar += g.select(suf().xtx());
    Matrix L = ivar.chol(ok);
    if(!ok)  return BOOM::negative_infinity();
    double denom = sum(log(L.diag()));  // = .5 log |ivar|
    Vector S = g.select(suf().xty()) + ivar_mu;
    Lsolve_inplace(L,S);
    denom-= .5*S.normsq();  // S.normsq =  beta_tilde ^T V_tilde beta_tilde
    return num-denom;
  }
开发者ID:MarkEdmondson1234,项目名称:Boom,代码行数:30,代码来源:BinomialLogitSpikeSlabSampler.cpp

示例2: log_likelihood_ivar

 // The likelihood is \prod root(2pi)^-d |siginv|^{n/2} exp{-1/2 * trace(qform)}
 double MvReg::log_likelihood_ivar(const Matrix &Beta,
                                   const SpdMatrix &Siginv) const {
   double qform = trace(suf()->SSE(Beta) * Siginv);
   double n = suf()->n();
   double normalizing_constant = -.5 * (n * ydim()) * Constants::log_2pi;
   return normalizing_constant + .5 * n * Siginv.logdet() - .5 * qform;
 }
开发者ID:steve-the-bayesian,项目名称:BOOM,代码行数:8,代码来源:MultivariateRegression.cpp

示例3: dmvt

  //======================================================================
  double dmvt(const Vector &x,  const Vector &mu,
 	      const SpdMatrix &Siginv, double nu, bool logscale){
    double ldsi = Siginv.logdet();
    return dmvt(x, mu, Siginv, nu, ldsi, logscale);
  }
开发者ID:MarkEdmondson1234,项目名称:Boom,代码行数:6,代码来源:mvt.cpp

示例4: dmvn

 double dmvn(const Vector &y, const Vector &mu, const SpdMatrix &Siginv,
             bool logscale) {
   double ldsi = Siginv.logdet();
   return dmvn(y, mu, Siginv, ldsi, logscale);
 }
开发者ID:cran,项目名称:Boom,代码行数:5,代码来源:mvn.cpp


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