Skip to content

Commit

Permalink
Patch a few source code bugs (#188)
Browse files Browse the repository at this point in the history
* explicitly cast sparse matrix

* fix travis badge

* bump patch version
  • Loading branch information
zdk123 committed Oct 20, 2021
1 parent ff528b2 commit c463727
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: SpiecEasi
Title: Sparse Inverse Covariance for Ecological Statistical Inference
Version: 1.1.1
Version: 1.1.2
Authors@R: c(
person("Zachary", "Kurtz", role = c("aut", "cre"), email="[email protected]"),
person("Christian", "Mueller", role = "aut"),
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if (!runchunks) load('.README.RData')
```
SpiecEasi
=========
[![Build Status](https://travis-ci.org/zdk123/SpiecEasi.svg?branch=pulsar)](https://travis-ci.org/zdk123/SpiecEasi)
[![Build Status](https://app.travis-ci.com/zdk123/SpiecEasi.svg?branch=master)](https://app.travis-ci.com/zdk123/SpiecEasi)

Sparse InversE Covariance estimation for Ecological Association and Statistical Inference

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
SpiecEasi
=========

[![Build
Status](https://travis-ci.org/zdk123/SpiecEasi.svg?branch=pulsar)](https://travis-ci.org/zdk123/SpiecEasi)
[![Build Status](https://app.travis-ci.com/zdk123/SpiecEasi.svg?branch=master)](https://app.travis-ci.com/zdk123/SpiecEasi)

Sparse InversE Covariance estimation for Ecological Association and
Statistical Inference
Expand Down
8 changes: 4 additions & 4 deletions src/ADMM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ arma::mat sqrtmNewt2(arma::mat& C, arma::mat& sqrt0, const double& errTol) {

arma::sp_mat SOFTTHRESH2(arma::mat& Sig, const float& lambda, const bool& shrinkDiag = true) {
arma::mat A = symmatu(Sig);
int n = A.n_cols;
// int n = A.n_cols;
arma::sp_mat S(sign(A));
arma::mat M(abs(A)-lambda);
M.elem(find(M < 0)).zeros();
Expand All @@ -33,9 +33,9 @@ arma::sp_mat SOFTTHRESH2(arma::mat& Sig, const float& lambda, const bool& shrink


void svdPowSym(arma::mat& U, arma::vec& d, arma::mat& V, arma::mat& A, int k, int q) {
int l = k;
// int l = k;
int m = A.n_rows;
int n = A.n_cols;
// int n = A.n_cols;
arma::mat P = randu<mat>(m,k-1);
arma::mat Q, R;
qr(Q, R, (P.t()*A).t());
Expand Down Expand Up @@ -190,7 +190,7 @@ List ADMM(const arma::mat& SigmaO, const double& lambda, arma::mat& I,
}

X.cols(0 , n-1 ) = R;
X.cols(n , n*2-1) = S;
X.cols(n , n*2-1) = arma::mat(S);
X.cols(n*2, n*3-1) = L;

RO = over_relax_par*R + (1-over_relax_par)*RY;
Expand Down
5 changes: 5 additions & 0 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

using namespace Rcpp;

#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// ADMM
List ADMM(const arma::mat& SigmaO, const double& lambda, arma::mat& I, arma::mat& Lambda, arma::mat& Y, double beta, int r, double mu, const double& eta, const double& muf, const int& maxiter, const double& newtol, const double& tol, const double& over_relax_par, bool shrinkDiag);
RcppExport SEXP _SpiecEasi_ADMM(SEXP SigmaOSEXP, SEXP lambdaSEXP, SEXP ISEXP, SEXP LambdaSEXP, SEXP YSEXP, SEXP betaSEXP, SEXP rSEXP, SEXP muSEXP, SEXP etaSEXP, SEXP mufSEXP, SEXP maxiterSEXP, SEXP newtolSEXP, SEXP tolSEXP, SEXP over_relax_parSEXP, SEXP shrinkDiagSEXP) {
Expand Down
2 changes: 1 addition & 1 deletion src/svthresh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using namespace arma;
//soft thresholding operator of symmetric matrix
arma::sp_mat SOFTTHRESH(arma::mat Sig, float lambda, bool shrinkDiag = true) {
arma::mat A = symmatu(Sig);
int n = A.n_cols;
// int n = A.n_cols;
arma::sp_mat S(sign(A));
arma::mat M(abs(A)-lambda);
M.elem(find(M < 0)).zeros();
Expand Down

0 comments on commit c463727

Please sign in to comment.