Skip to content

Commit 09c68ce

Browse files
author
Jie Ren
committed
fix NA in u vector
1 parent 0fa1cec commit 09c68ce

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

R/print.regnet.R

-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#' @param x a cv.regnet object.
66
#' @param digits significant digits in the printout.
77
#' @param ... other print arguments
8-
#' @usage \method{print}{cv.regnet}(x, digits = max(3, getOption("digits") - 3), \dots)
98
#' @seealso \code{\link{cv.regnet}}
109
#' @export
1110
print.cv.regnet=function(x, digits = max(3, getOption("digits") - 3),...){
@@ -29,7 +28,6 @@ print.cv.regnet=function(x, digits = max(3, getOption("digits") - 3),...){
2928
#' @param x a regnet object.
3029
#' @param digits significant digits in the printout.
3130
#' @param ... other print arguments
32-
#' @usage \method{print}{regnet}(x, digits = max(3, getOption("digits") - 3), \dots)
3331
#' @seealso \code{\link{regnet}}
3432
#' @export
3533
print.regnet=function(x, digits = max(3, getOption("digits") - 3),...){

man/print.cv.regnet.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/print.regnet.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/QR.cpp

+9-7
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ arma::vec QRWMR(arma::mat const &x, arma::vec const &y, arma::vec b, bool debugg
1818
u = t/x.col(m);
1919
w = arma::abs(x.col(m))/n;
2020

21-
u.replace(datum::nan, 0);
21+
u.elem(arma::find(x.col(m) == 0)).fill(0);
2222

2323
if (debugging) {
24-
Rcpp::Rcout << "Values of u before NaN replacement for column " << m << ":\n";
25-
u.print(Rcpp::Rcout);
24+
// Rcpp::Rcout << "Values of u before NaN replacement for column " << m << ":\n";
25+
// u.print(Rcpp::Rcout);
26+
u.replace(datum::nan, 0);
2627
}
2728

2829
index = arma::sort_index(u);
@@ -53,13 +54,14 @@ void QRWMR(arma::mat const &x, arma::vec const &y, arma::vec &b, arma::mat const
5354
t += x.col(m) * b(m);
5455
u = t/x.col(m);
5556

57+
u.elem(arma::find(x.col(m) == 0)).fill(0);
58+
5659
if (debugging) {
57-
Rcpp::Rcout << "Values of u before NaN replacement for column " << m << ":\n";
58-
u.print(Rcpp::Rcout);
60+
// Rcpp::Rcout << "Values of u before NaN replacement for column " << m << ":\n";
61+
// u.print(Rcpp::Rcout);
62+
u.replace(datum::nan, 0);
5963
}
6064

61-
u.replace(datum::nan, 0);
62-
6365
index = arma::sort_index(u);
6466

6567
double SUM = 0;

0 commit comments

Comments
 (0)