Skip to content

Commit

Permalink
Merge pull request #37 from yixuan/Eigen3.2.9
Browse files Browse the repository at this point in the history
Update to Eigen 3.2.9
  • Loading branch information
eddelbuettel committed Aug 20, 2016
2 parents 04a24c3 + 947d171 commit f8ba1ed
Show file tree
Hide file tree
Showing 36 changed files with 282 additions and 217 deletions.
9 changes: 8 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
2016-08-19 Yixuan Qiu <yixuan.qiu@cos.name>

* inst/include/Eigen: Updated to release 3.2.9 of Eigen
* DESCRIPTION: Idem

* README.md: Updated version number and fixed the NOTE from CRAN URL check

2016-04-30 Dirk Eddelbuettel <edd@debian.org>

* README.md: Expanded

2016-04-28 James Joseph Balamuta <balamut2@illinois.edu>

* inst/include/RcppEigenWrap.h: Added an exporter class for Map::RowVectorX<t> per
* inst/include/RcppEigenWrap.h: Added an exporter class for Map::RowVectorX<t> per
http://stackoverflow.com/questions/36920689/rowvectorxd-not-supported-in-rcppeigen
* inst/include/unitTests/runit.RcppEigen.R: Added row exporter unit test.

Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: RcppEigen
Type: Package
Title: 'Rcpp' Integration for the 'Eigen' Templated Linear Algebra Library
Version: 0.3.2.8.1
Date: 2016-02-28
Version: 0.3.2.9.0
Date: 2016-08-19
Author: Douglas Bates, Dirk Eddelbuettel, Romain Francois, and Yixuan Qiu;
the authors of Eigen for the included version of Eigen
Maintainer: Dirk Eddelbuettel <edd@debian.org>
Expand All @@ -16,7 +16,7 @@ Description: R and 'Eigen' integration using 'Rcpp'.
implementations based on 'Lapack' and level-3 'BLAS'.
.
The 'RcppEigen' package includes the header files from the 'Eigen' C++
template library (currently version 3.2.8). Thus users do not need to
template library (currently version 3.2.9). Thus users do not need to
install 'Eigen' itself in order to use 'RcppEigen'.
.
Since version 3.1.1, 'Eigen' is licensed under the Mozilla Public License
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## RcppEigen

[![Build Status](https://travis-ci.org/RcppCore/RcppEigen.svg)](https://travis-ci.org/RcppCore/RcppEigen) [![License](http://img.shields.io/badge/license-GPL%20%28%3E=%202%29-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html) [![License](http://img.shields.io/badge/license-MPL2-brightgreen.svg?style=flat)](http://www.mozilla.org/MPL/2.0/) [![CRAN](http://www.r-pkg.org/badges/version/RcppEigen)](http://cran.rstudio.com/package=RcppEigen) [![Downloads](http://cranlogs.r-pkg.org/badges/RcppEigen?color=brightgreen)](http://www.r-pkg.org/pkg/RcppEigen)
[![Build Status](https://travis-ci.org/RcppCore/RcppEigen.svg)](https://travis-ci.org/RcppCore/RcppEigen) [![License](http://img.shields.io/badge/license-GPL%20%28%3E=%202%29-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html) [![License](http://img.shields.io/badge/license-MPL2-brightgreen.svg?style=flat)](http://www.mozilla.org/MPL/2.0/) [![CRAN](http://www.r-pkg.org/badges/version/RcppEigen)](http://cran.r-project.org/package=RcppEigen) [![Downloads](http://cranlogs.r-pkg.org/badges/RcppEigen?color=brightgreen)](http://www.r-pkg.org/pkg/RcppEigen)

### Overview

Expand All @@ -12,18 +12,18 @@ systems. Its performance on many algorithms is comparable with some of the
best implementations based on `Lapack` and level-3 `BLAS`.

The RcppEigen package includes the header files from the Eigen C++
template library (currently version 3.2.8). Thus users do not need to
template library (currently version 3.2.9). Thus users do not need to
install Eigen itself in order to use RcppEigen.

### Status

The package is reasonably mature and under active development, following the
The package is reasonably mature and under active development, following the
[Eigen](http://eigen.tuxfamily.org) release cycle.

### Documentation

The package contains a pdf vignette which is a pre-print of the [paper by
Bates and Eddelbuettel](https://www.jstatsoft.org/article/view/v052i05)
Bates and Eddelbuettel](https://www.jstatsoft.org/article/view/v052i05)
in JSS (2013, v52i05).

### Authors
Expand All @@ -33,4 +33,3 @@ Douglas Bates, Dirk Eddelbuettel, Romain Francois, and Yixuan Qiu
### License

GPL (>= 2)

17 changes: 8 additions & 9 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
\newcommand{\ghpr}{\href{https://github.com/RcppCore/RcppEigen/pull/#1}{##1}}
\newcommand{\ghit}{\href{https://github.com/RcppCore/RcppEigen/issues/#1}{##1}}

\section{Changes in RcppEigen version 0.3.X.Y.Z (2016-XX-YY)}{
\section{Changes in RcppEigen version 0.3.2.9.0 (2016-08-19)}{
\itemize{
\item An exporter for RowVectorX was added (thanks to PR \ghpr{32}
by James Balamuta)
by James Balamuta)
\item Updated to version 3.2.9 of Eigen
}
}

Expand Down Expand Up @@ -54,7 +55,7 @@
\CRANpkg{pkgKitten} if available
}
}

\section{Changes in RcppEigen version 0.3.2.3.0 (2014-12-22)}{
\itemize{
\item Updated to version 3.2.3 of Eigen
Expand Down Expand Up @@ -85,7 +86,7 @@
the cpu id comparison, with thanks to Gael Guennebaud for the patch
}
}

\section{Changes in RcppEigen version 0.3.2.1.1 (2014-03-06)}{
\itemize{
\item Better \code{ifdef} on one directory entry feature, with
Expand All @@ -103,7 +104,7 @@
\itemize{
\item Updated and extended \code{RcppEigen.package.skeleton()} to
use several examples via \CRANpkg{Rcpp} Attributes; also removed the
deprecated \code{namespace} argument
deprecated \code{namespace} argument
\item Updated skeleton package example for \CRANpkg{Rcpp} 0.11.0 or
later by removing needed for linking with user library
\item Updated files \code{DESCRIPTION}, \code{NAMESPACE},
Expand All @@ -128,7 +129,7 @@
\item Applied two small patches to deal with non-g++ compilrs
\item Clarifications concerning license and authorship of
Eigen (as opposed to RcppEigen) code added to \code{DESCRIPTION} at
the request of CRAN
the request of CRAN
}
}

Expand Down Expand Up @@ -157,7 +158,7 @@
which cannot be changed to a ColMajor form.
\item Because of changes in R, -DNDEBUG is automatic. One must
override it with -UNDEBUG in the local ~/.R/Makevars to activate the
debugging code.
debugging code.
\item New (unexported) functions CxxFlags() and RcppEigenCxxFlags()
for use in Makefiles
\item Fixes related to Rcpp 0.10.*
Expand Down Expand Up @@ -210,5 +211,3 @@
some difficulty with combining testthat, inline and R CMD check.
}
}


7 changes: 5 additions & 2 deletions inst/include/Eigen/src/Core/CommaInitializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ struct CommaInitializer
template<typename OtherDerived>
CommaInitializer& operator,(const DenseBase<OtherDerived>& other)
{
if(other.cols()==0 || other.rows()==0)
if(other.rows()==0)
{
m_col += other.cols();
return *this;
}
if (m_col==m_xpr.cols())
{
m_row+=m_currentBlockRows;
Expand All @@ -86,7 +89,7 @@ struct CommaInitializer
eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows()
&& "Too many rows passed to comma initializer (operator<<)");
}
eigen_assert(m_col<m_xpr.cols()
eigen_assert((m_col<m_xpr.cols() || (m_xpr.cols()==0 && m_col==0))
&& "Too many coefficients passed to comma initializer (operator<<)");
eigen_assert(m_currentBlockRows==other.rows());
if (OtherDerived::SizeAtCompileTime != Dynamic)
Expand Down
6 changes: 3 additions & 3 deletions inst/include/Eigen/src/Core/DiagonalMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ class DiagonalBase : public EigenBase<Derived>
template<typename DenseDerived>
void evalTo(MatrixBase<DenseDerived> &other) const;
template<typename DenseDerived>
void addTo(MatrixBase<DenseDerived> &other) const
inline void addTo(MatrixBase<DenseDerived> &other) const
{ other.diagonal() += diagonal(); }
template<typename DenseDerived>
void subTo(MatrixBase<DenseDerived> &other) const
inline void subTo(MatrixBase<DenseDerived> &other) const
{ other.diagonal() -= diagonal(); }

inline const DiagonalVectorType& diagonal() const { return derived().diagonal(); }
Expand Down Expand Up @@ -98,7 +98,7 @@ class DiagonalBase : public EigenBase<Derived>

template<typename Derived>
template<typename DenseDerived>
void DiagonalBase<Derived>::evalTo(MatrixBase<DenseDerived> &other) const
inline void DiagonalBase<Derived>::evalTo(MatrixBase<DenseDerived> &other) const
{
other.setZero();
other.diagonal() = diagonal();
Expand Down
2 changes: 1 addition & 1 deletion inst/include/Eigen/src/Core/Dot.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct dot_nocheck<T, U, true>
*/
template<typename Derived>
template<typename OtherDerived>
typename internal::scalar_product_traits<typename internal::traits<Derived>::Scalar,typename internal::traits<OtherDerived>::Scalar>::ReturnType
inline typename internal::scalar_product_traits<typename internal::traits<Derived>::Scalar,typename internal::traits<OtherDerived>::Scalar>::ReturnType
MatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
Expand Down
5 changes: 0 additions & 5 deletions inst/include/Eigen/src/Core/GeneralProduct.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,6 @@ class GeneralProduct<Lhs, Rhs, InnerProduct>
public:
GeneralProduct(const Lhs& lhs, const Rhs& rhs)
{
EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::RealScalar, typename Rhs::RealScalar>::value),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)

Base::coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum();
}

Expand Down Expand Up @@ -264,8 +261,6 @@ class GeneralProduct<Lhs, Rhs, OuterProduct>

GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs)
{
EIGEN_STATIC_ASSERT((internal::is_same<typename Lhs::RealScalar, typename Rhs::RealScalar>::value),
YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
}

struct set { template<typename Dst, typename Src> void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() = src; } };
Expand Down
21 changes: 16 additions & 5 deletions inst/include/Eigen/src/Core/MathFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ struct conj_retval
* Implementation of abs2 *
****************************************************************************/

template<typename Scalar>
struct abs2_impl
template<typename Scalar,bool IsComplex>
struct abs2_impl_default
{
typedef typename NumTraits<Scalar>::Real RealScalar;
static inline RealScalar run(const Scalar& x)
Expand All @@ -228,15 +228,26 @@ struct abs2_impl
}
};

template<typename RealScalar>
struct abs2_impl<std::complex<RealScalar> >
template<typename Scalar>
struct abs2_impl_default<Scalar, true> // IsComplex
{
static inline RealScalar run(const std::complex<RealScalar>& x)
typedef typename NumTraits<Scalar>::Real RealScalar;
static inline RealScalar run(const Scalar& x)
{
return real(x)*real(x) + imag(x)*imag(x);
}
};

template<typename Scalar>
struct abs2_impl
{
typedef typename NumTraits<Scalar>::Real RealScalar;
static inline RealScalar run(const Scalar& x)
{
return abs2_impl_default<Scalar,NumTraits<Scalar>::IsComplex>::run(x);
}
};

template<typename Scalar>
struct abs2_retval
{
Expand Down
3 changes: 2 additions & 1 deletion inst/include/Eigen/src/Core/PermutationMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,11 @@ struct permut_matrix_product_retval
const Index n = Side==OnTheLeft ? rows() : cols();
// FIXME we need an is_same for expression that is not sensitive to constness. For instance
// is_same_xpr<Block<const Matrix>, Block<Matrix> >::value should be true.
const typename Dest::Scalar *dst_data = internal::extract_data(dst);
if( is_same<MatrixTypeNestedCleaned,Dest>::value
&& blas_traits<MatrixTypeNestedCleaned>::HasUsableDirectAccess
&& blas_traits<Dest>::HasUsableDirectAccess
&& extract_data(dst) == extract_data(m_matrix))
&& dst_data!=0 && dst_data == extract_data(m_matrix))
{
// apply the permutation inplace
Matrix<bool,PermutationType::RowsAtCompileTime,1,0,PermutationType::MaxRowsAtCompileTime> mask(m_permutation.size());
Expand Down
6 changes: 3 additions & 3 deletions inst/include/Eigen/src/Core/PlainObjectBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
EIGEN_STRONG_INLINE void resizeLike(const EigenBase<OtherDerived>& _other)
{
const OtherDerived& other = _other.derived();
internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(other.rows(), other.cols());
const Index othersize = other.rows()*other.cols();
internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(Index(other.rows()), Index(other.cols()));
const Index othersize = Index(other.rows())*Index(other.cols());
if(RowsAtCompileTime == 1)
{
eigen_assert(other.rows() == 1 || other.cols() == 1);
Expand Down Expand Up @@ -487,7 +487,7 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
/** \sa MatrixBase::operator=(const EigenBase<OtherDerived>&) */
template<typename OtherDerived>
EIGEN_STRONG_INLINE PlainObjectBase(const EigenBase<OtherDerived> &other)
: m_storage(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols())
: m_storage(Index(other.derived().rows()) * Index(other.derived().cols()), other.derived().rows(), other.derived().cols())
{
_check_template_params();
internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(other.derived().rows(), other.derived().cols());
Expand Down
3 changes: 2 additions & 1 deletion inst/include/Eigen/src/Core/SolveTriangular.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ template<int Side, typename TriangularType, typename Rhs> struct triangular_solv

template<typename Dest> inline void evalTo(Dest& dst) const
{
if(!(is_same<RhsNestedCleaned,Dest>::value && extract_data(dst) == extract_data(m_rhs)))
const typename Dest::Scalar *dst_data = internal::extract_data(dst);
if(!(is_same<RhsNestedCleaned,Dest>::value && dst_data!=0 && extract_data(dst) == extract_data(m_rhs)))
dst = m_rhs;
m_triangularMatrix.template solveInPlace<Side>(dst);
}
Expand Down
9 changes: 4 additions & 5 deletions inst/include/Eigen/src/Core/Transpose.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,11 @@ inline void MatrixBase<Derived>::adjointInPlace()

namespace internal {

template<typename BinOp,typename NestedXpr,typename Rhs>
struct blas_traits<SelfCwiseBinaryOp<BinOp,NestedXpr,Rhs> >
: blas_traits<NestedXpr>
template<typename BinOp,typename Xpr,typename Rhs>
struct blas_traits<SelfCwiseBinaryOp<BinOp,Xpr,Rhs> >
: blas_traits<typename internal::remove_all<typename Xpr::Nested>::type>
{
typedef SelfCwiseBinaryOp<BinOp,NestedXpr,Rhs> XprType;
typedef SelfCwiseBinaryOp<BinOp,Xpr,Rhs> XprType;
static inline const XprType extract(const XprType& x) { return x; }
};

Expand Down Expand Up @@ -392,7 +392,6 @@ struct checkTransposeAliasing_impl
::run(extract_data(dst), other))
&& "aliasing detected during transposition, use transposeInPlace() "
"or evaluate the rhs into a temporary using .eval()");

}
};

Expand Down
3 changes: 2 additions & 1 deletion inst/include/Eigen/src/Core/Transpositions.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ struct transposition_matrix_product_retval
const int size = m_transpositions.size();
Index j = 0;

if(!(is_same<MatrixTypeNestedCleaned,Dest>::value && extract_data(dst) == extract_data(m_matrix)))
const typename Dest::Scalar *dst_data = internal::extract_data(dst);
if(!(is_same<MatrixTypeNestedCleaned,Dest>::value && dst_data!=0 && dst_data == extract_data(m_matrix)))
dst = m_matrix;

for(int k=(Transposed?size-1:0) ; Transposed?k>=0:k<size ; Transposed?--k:++k)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ EIGEN_DONT_INLINE void triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conju
// coherence when accessing the rhs elements
std::ptrdiff_t l1, l2;
manage_caching_sizes(GetAction, &l1, &l2);
Index subcols = cols>0 ? l2/(4 * sizeof(Scalar) * otherStride) : 0;
Index subcols = cols>0 ? l2/(4 * sizeof(Scalar) * std::max<Index>(otherStride,size)) : 0;
subcols = std::max<Index>((subcols/Traits::nr)*Traits::nr, Traits::nr);

for(Index k2=IsLower ? 0 : size;
Expand Down
Loading

0 comments on commit f8ba1ed

Please sign in to comment.