Skip to content

Commit

Permalink
A few minor edits to the C++ code.
Browse files Browse the repository at this point in the history
  • Loading branch information
pcarbo committed Oct 25, 2023
1 parent 5cce8b8 commit 8865b38
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Encoding: UTF-8
Type: Package
Package: fastglmpca
Version: 0.1-71
Date: 2023-10-24
Version: 0.1-72
Date: 2023-10-25
Title: Fast Algorithms for Generalized Principal Component Analysis
Authors@R: c(person("Eric","Weine",role=c("aut","cre"),
email="[email protected]"),
Expand Down
2 changes: 1 addition & 1 deletion src/pois_reg2.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <Rcpp.h>
#include <RcppArmadillo.h>
#include <RcppParallel.h>
#include <Rcpp.h>

using namespace arma;
using namespace Rcpp;
Expand Down
12 changes: 6 additions & 6 deletions src/utils.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#include <RcppArmadillo.h>
#include <Rcpp.h>
#include <RcppArmadillo.h>
#include <RcppParallel.h>

using namespace arma;
using namespace Rcpp;
using namespace RcppParallel;

// L is K x n
// F is K x p
Expand All @@ -11,12 +13,9 @@ using namespace Rcpp;
double big_exp_crossprod (const arma::mat& L, const arma::mat& F,
const int n, const int m) {
double sum = 0;

// First, get this code to work without parallelism
// Then, I can see if that would help
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
sum = sum + exp(dot(L.col(i), F.col(j)));
sum = sum + exp(dot(L.col(i),F.col(j)));
return(sum);
}

Expand All @@ -33,7 +32,8 @@ double big_elementwise_mult_crossprod(
const int num_nonzero_y) {
double sum = 0;
for (int r = 0; r < num_nonzero_y; r++)
sum = sum + nonzero_y[r] * dot(L.col(nonzero_y_i_idx[r]), F.col(nonzero_y_j_idx[r]));
sum = sum + nonzero_y[r] * dot(L.col(nonzero_y_i_idx[r]),
F.col(nonzero_y_j_idx[r]));
return(sum);
}

Expand Down

0 comments on commit 8865b38

Please sign in to comment.