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) 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(); } }; /*********************************************************************** 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/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:
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)