Skip to content

Commit

Permalink
v0.3.5. using Mat<T> consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
pachadotdev committed Mar 3, 2024
1 parent 82465ab commit a77f5ce
Show file tree
Hide file tree
Showing 34 changed files with 81 additions and 75 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: capybara
Type: Package
Title: Fast and Memory Efficient Fitting of Linear Models With High-Dimensional
Fixed Effects
Version: 0.3
Version: 0.3.5
Authors@R: c(
person(
given = "Mauricio",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# capybara 0.3.5

* Uses Mat<T> consistently for all matrix operations (avoids vectors)

# capybara 0.3

* Reduces memory footprint ~45% by moving some computation to Armadillo's side
Expand Down
2 changes: 1 addition & 1 deletion R/apes.R
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ apes <- function(
rm(eta, w, z, MPsi)

# Compute covariance matrix
# Gamma <- (MX %*% solve(object[["Hessian"]] / nt.full, J) - PPsi) * v / nt.full
Gamma <- gamma_(MX, object[["Hessian"]], J, PPsi, v, nt.full)
V <- crossprod_(Gamma, NA_real_, FALSE, FALSE)

if (adj > 0.0) {
# Simplify covariance if sampling assumptions are imposed
if (sampling.fe == "independence") {
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/LICENSE.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/intro.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ pkgdown: 2.0.7
pkgdown_sha: ~
articles:
intro: intro.html
last_built: 2024-03-03T11:14Z
last_built: 2024-03-03T21:12Z

4 changes: 2 additions & 2 deletions docs/reference/apes.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/reference/bias_corr.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/capybara-package.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/reference/feglm.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/feglm_control.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/reference/felm.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/reference/fenegbin.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/reference/fepoisson.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/fixed_effects.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/reexports.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/summary.apes.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/summary.feglm.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/summary.felm.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/trade_panel.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/vcov.apes.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/vcov.feglm.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/vcov.felm.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/01_center_variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ center_variables_(const doubles_matrix<> &V_r, const doubles &v_sum_r,
const int maxiter, bool sum_v) {
// Types conversion
Mat<double> V = as_Mat(V_r);
Col<double> w = as_Col(w_r);
Mat<double> w = as_Mat(w_r);

if (sum_v) {
Col<double> v_sum = as_Col(v_sum_r);
Mat<double> v_sum = as_Mat(v_sum_r);
V.each_col() += v_sum;
}

Expand All @@ -24,8 +24,8 @@ center_variables_(const doubles_matrix<> &V_r, const doubles &v_sum_r,
double delta, denom, meanj, num, wt;
int index, iter, i, j, k, p, I, J;
Mat<double> C(N, P);
Col<double> x(N);
Col<double> x0(N);
Mat<double> x(N, 1);
Mat<double> x0(N, 1);

// Halperin projections
for (p = 0; p < P; p++) {
Expand Down
4 changes: 2 additions & 2 deletions src/02_solve_beta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// Weight the X and Y matrices
if (weighted) {
// Additional type conversion
Col<double> W = as_Col(wtilde);
Mat<double> W = as_Mat(wtilde);

// Multiply each column of X by W pair-wise
X = X.each_col() % W;
Expand All @@ -32,7 +32,7 @@
stop("QR decomposition failed");
} else {
// backsolve
Col<double> beta = solve(R, Q.t() * Y);
Mat<double> beta = solve(R, Q.t() * Y);
return as_doubles(beta);
}
}
Loading

0 comments on commit a77f5ce

Please sign in to comment.