From 37054987217d04cf649ba86324092bc14e9f0788 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 26 Aug 2009 00:24:22 +0200 Subject: [PATCH 1/4] add coeff(int,int), coeff(int) and value() functions to the inner product specialization --- Eigen/src/Core/Product.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index d70344deb..71203a362 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -164,11 +164,20 @@ class GeneralProduct GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) {} + EIGEN_STRONG_INLINE Scalar value() const + { + return (m_lhs.transpose().cwise()*m_rhs).sum(); + } + template void scaleAndAddTo(Dest& dst, Scalar alpha) const { ei_assert(dst.rows()==1 && dst.cols()==1); - dst.coeffRef(0,0) += alpha * (m_lhs.transpose().cwise()*m_rhs).sum(); + dst.coeffRef(0,0) += alpha * value(); } + + EIGEN_STRONG_INLINE Scalar coeff(int, int) const { return value(); } + + EIGEN_STRONG_INLINE Scalar coeff(int) const { return value(); } }; /*********************************************************************** From 76fa46c6db95a1563076e8bda2c96bd69f4a4adf Mon Sep 17 00:00:00 2001 From: Jitse Niesen Date: Wed, 26 Aug 2009 18:53:56 +0100 Subject: [PATCH 2/4] Typos in tutorial --- doc/C05_TutorialLinearAlgebra.dox | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/C05_TutorialLinearAlgebra.dox b/doc/C05_TutorialLinearAlgebra.dox index e70298b47..fbf809d58 100644 --- a/doc/C05_TutorialLinearAlgebra.dox +++ b/doc/C05_TutorialLinearAlgebra.dox @@ -23,7 +23,7 @@ solving systems of linear equations, finding eigenvalues and eigenvectors, and s \section TutorialAdvSolvers Solving linear problems -This part of the tutorial focuses on solving systems of linear equations. Such statems can be +This part of the tutorial focuses on solving systems of linear equations. Such systems can be written in the form \f$ A \mathbf{x} = \mathbf{b} \f$, where both \f$ A \f$ and \f$ \mathbf{b} \f$ are known, and \f$ \mathbf{x} \f$ is the unknown. Moreover, \f$ A \f$ is assumed to be a square matrix. @@ -105,7 +105,7 @@ then the system \f$ A \mathbf{x} = \mathbf{b} \f$ has either zero or infinitely both cases, PartialLU::solve() will give nonsense results. For example, suppose that we want to solve the same system as above, but with the 10 in the last equation replaced by 9. Then the system of equations is inconsistent: adding the first and the third equation gives \f$ 8x + 10y + 12z = 7 \f$, -which implies \f$ 4x + 5y + 6z = 3\frac12 \f$, in contradiction with the seocond equation. If we try +which implies \f$ 4x + 5y + 6z = 3\frac12 \f$, in contradiction with the second equation. If we try to solve this inconsistent system with Eigen, we find:
From 227f6cbce08b5dbd6f49224857c70b78380fbb73 Mon Sep 17 00:00:00 2001 From: John Smith Date: Fri, 28 Aug 2009 00:05:44 +0200 Subject: [PATCH 3/4] Fixed SSE related build warning on 64-bit windows systems. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d06f616a..c229a2858 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,7 +94,10 @@ if(MSVC) option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF) if(EIGEN_TEST_SSE2) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") + if(NOT CMAKE_CL_64) + # arch is not supported on 64 bit systems, SSE is enabled automatically. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") + endif(NOT CMAKE_CL_64) message("Enabling SSE2 in tests/examples") endif(EIGEN_TEST_SSE2) endif(MSVC) From aacada166263dd8022643d5c224b796701eba2c4 Mon Sep 17 00:00:00 2001 From: John Smith Date: Fri, 28 Aug 2009 20:14:18 +0200 Subject: [PATCH 4/4] Force release builds on Windows machines in the test suite. Added an IGNORE_CVS flag to the test suite (allows submitting local and modified repositories). Fixed the EI_OFLAG for MSVC. --- cmake/EigenTesting.cmake | 8 +++----- test/testsuite.cmake | 16 ++++++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmake/EigenTesting.cmake b/cmake/EigenTesting.cmake index 571774787..e3a87f645 100644 --- a/cmake/EigenTesting.cmake +++ b/cmake/EigenTesting.cmake @@ -160,11 +160,9 @@ if(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g2") endif(CMAKE_SYSTEM_NAME MATCHES Linux) set(EI_OFLAG "-O2") -# MSVC fails with: -# cl : Command line warning D9025 : overriding '/Od' with '/O2' -# cl : Command line error D8016 : '/RTC1' and '/O2' command-line options are incompatible -# elseif(MSVC) -# set(EI_OFLAG "/O2") +elseif(MSVC) + set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd /Zi /Ob0 /Od" CACHE STRING "Flags used by the compiler during debug builds." FORCE) + set(EI_OFLAG "/O2") else(CMAKE_COMPILER_IS_GNUCXX) set(EI_OFLAG "") endif(CMAKE_COMPILER_IS_GNUCXX) diff --git a/test/testsuite.cmake b/test/testsuite.cmake index f3b0e4172..6a44ce239 100644 --- a/test/testsuite.cmake +++ b/test/testsuite.cmake @@ -132,8 +132,11 @@ endif(NOT EIGEN_MODE) ## mandatory variables (the default should be ok in most cases): -SET (CTEST_CVS_COMMAND "hg") -SET (CTEST_CVS_CHECKOUT "${CTEST_CVS_COMMAND} clone http://bitbucket.org/eigen/eigen2 \"${CTEST_SOURCE_DIRECTORY}\"") +if(NOT IGNORE_CVS) + SET (CTEST_CVS_COMMAND "hg") + SET (CTEST_CVS_CHECKOUT "${CTEST_CVS_COMMAND} clone http://bitbucket.org/eigen/eigen2 \"${CTEST_SOURCE_DIRECTORY}\"") + SET(CTEST_BACKUP_AND_RESTORE TRUE) # the backup is CVS related ... +endif(NOT IGNORE_CVS) # which ctest command to use for running the dashboard SET (CTEST_COMMAND "${EIGEN_CMAKE_DIR}ctest -D ${EIGEN_MODE}") @@ -150,7 +153,6 @@ SET($ENV{LC_MESSAGES} "en_EN") # should ctest wipe the binary tree before running SET(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) -SET(CTEST_BACKUP_AND_RESTORE TRUE) # this is the initial cache to use for the binary tree, be careful to escape # any quotes inside of this string if you use it @@ -160,7 +162,8 @@ if(WIN32 AND NOT UNIX) SET (CTEST_INITIAL_CACHE " MAKECOMMAND:STRING=nmake -i CMAKE_MAKE_PROGRAM:FILEPATH=nmake - CMAKE_GENERATOR:INTERNAL=NMake Makefiles + CMAKE_GENERATOR:INTERNAL=NMake Makefiles + CMAKE_BUILD_TYPE:STRING=Release BUILDNAME:STRING=${EIGEN_BUILD_STRING} SITE:STRING=${EIGEN_SITE} ") @@ -172,10 +175,11 @@ else(WIN32 AND NOT UNIX) endif(WIN32 AND NOT UNIX) # set any extra environment variables to use during the execution of the script here: +# setting this variable on windows machines causes trouble ... -if(EIGEN_CXX) +if(EIGEN_CXX AND NOT WIN32) set(CTEST_ENVIRONMENT "CXX=${EIGEN_CXX}") -endif(EIGEN_CXX) +endif(EIGEN_CXX AND NOT WIN32) if(DEFINED EIGEN_EXPLICIT_VECTORIZATION) if(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE2)