Skip to content

Commit a1f7dad

Browse files
committed
whitespace changes, added ChangeLog entry
1 parent 96d9e1c commit a1f7dad

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2022-01-15 Mikael Jagan <[email protected]>
2+
3+
* inst/include/RcppEigenWrap.h: Use R_xlen_t for vectors rows + cols
4+
15
2021-12-29 Dirk Eddelbuettel <[email protected]>
26

37
* README.md: Add total downloads badge

inst/include/RcppEigenWrap.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// RcppEigenWrap.h: Rcpp wrap methods for Eigen matrices, vectors and arrays
44
//
5-
// Copyright (C) 2011 - 2012 Douglas Bates, Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2011 - 2022 Douglas Bates, Dirk Eddelbuettel and Romain Francois
66
//
77
// This file is part of RcppEigen.
88
//
@@ -81,18 +81,18 @@ namespace Rcpp{
8181
// for plain dense objects
8282
template <typename T>
8383
SEXP eigen_wrap_plain_dense( const T& obj, Rcpp::traits::true_type ) {
84-
typename Eigen::internal::conditional<
85-
T::IsRowMajor,
86-
Eigen::Matrix<typename T::Scalar,
87-
T::RowsAtCompileTime,
88-
T::ColsAtCompileTime>,
89-
const T&>::type objCopy(obj);
90-
R_xlen_t m = obj.rows(), n = obj.cols(), size = m * n;
91-
SEXP ans = PROTECT(::Rcpp::wrap(objCopy.data(), objCopy.data() + size));
84+
typename Eigen::internal::conditional<
85+
T::IsRowMajor,
86+
Eigen::Matrix<typename T::Scalar,
87+
T::RowsAtCompileTime,
88+
T::ColsAtCompileTime>,
89+
const T&>::type objCopy(obj);
90+
R_xlen_t m = obj.rows(), n = obj.cols(), size = m * n;
91+
SEXP ans = PROTECT(::Rcpp::wrap(objCopy.data(), objCopy.data() + size));
9292
if ( T::ColsAtCompileTime != 1 ) {
93-
if (m > INT_MAX || n > INT_MAX) {
94-
throw std::runtime_error("array dimensions cannot exceed INT_MAX");
95-
}
93+
if (m > INT_MAX || n > INT_MAX) {
94+
Rcpp::stop("array dimensions cannot exceed INT_MAX");
95+
}
9696
SEXP dd = PROTECT(::Rf_allocVector(INTSXP, 2));
9797
int *d = INTEGER(dd);
9898
d[0] = m;

0 commit comments

Comments
 (0)