mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-05-12 15:58:05 +08:00
merge with tip
This commit is contained in:
commit
982a146a67
@ -94,7 +94,10 @@ if(MSVC)
|
|||||||
|
|
||||||
option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF)
|
option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF)
|
||||||
if(EIGEN_TEST_SSE2)
|
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")
|
message("Enabling SSE2 in tests/examples")
|
||||||
endif(EIGEN_TEST_SSE2)
|
endif(EIGEN_TEST_SSE2)
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
|
@ -164,11 +164,20 @@ class GeneralProduct<Lhs, Rhs, InnerProduct>
|
|||||||
|
|
||||||
GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) {}
|
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<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const
|
template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const
|
||||||
{
|
{
|
||||||
ei_assert(dst.rows()==1 && dst.cols()==1);
|
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(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -160,11 +160,9 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g2")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g2")
|
||||||
endif(CMAKE_SYSTEM_NAME MATCHES Linux)
|
endif(CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||||
set(EI_OFLAG "-O2")
|
set(EI_OFLAG "-O2")
|
||||||
# MSVC fails with:
|
elseif(MSVC)
|
||||||
# cl : Command line warning D9025 : overriding '/Od' with '/O2'
|
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MDd /Zi /Ob0 /Od" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
|
||||||
# cl : Command line error D8016 : '/RTC1' and '/O2' command-line options are incompatible
|
set(EI_OFLAG "/O2")
|
||||||
# elseif(MSVC)
|
|
||||||
# set(EI_OFLAG "/O2")
|
|
||||||
else(CMAKE_COMPILER_IS_GNUCXX)
|
else(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set(EI_OFLAG "")
|
set(EI_OFLAG "")
|
||||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
@ -23,7 +23,7 @@ solving systems of linear equations, finding eigenvalues and eigenvectors, and s
|
|||||||
|
|
||||||
\section TutorialAdvSolvers Solving linear problems
|
\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$
|
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
|
are known, and \f$ \mathbf{x} \f$ is the unknown. Moreover, \f$ A \f$ is assumed to be a square
|
||||||
matrix.
|
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
|
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
|
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$,
|
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:
|
to solve this inconsistent system with Eigen, we find:
|
||||||
|
|
||||||
<table class="tutorial_code"><tr><td>
|
<table class="tutorial_code"><tr><td>
|
||||||
|
@ -132,8 +132,11 @@ endif(NOT EIGEN_MODE)
|
|||||||
|
|
||||||
## mandatory variables (the default should be ok in most cases):
|
## mandatory variables (the default should be ok in most cases):
|
||||||
|
|
||||||
SET (CTEST_CVS_COMMAND "hg")
|
if(NOT IGNORE_CVS)
|
||||||
SET (CTEST_CVS_CHECKOUT "${CTEST_CVS_COMMAND} clone http://bitbucket.org/eigen/eigen2 \"${CTEST_SOURCE_DIRECTORY}\"")
|
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
|
# which ctest command to use for running the dashboard
|
||||||
SET (CTEST_COMMAND "${EIGEN_CMAKE_DIR}ctest -D ${EIGEN_MODE}")
|
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
|
# should ctest wipe the binary tree before running
|
||||||
SET(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE)
|
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
|
# 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
|
# any quotes inside of this string if you use it
|
||||||
@ -160,7 +162,8 @@ if(WIN32 AND NOT UNIX)
|
|||||||
SET (CTEST_INITIAL_CACHE "
|
SET (CTEST_INITIAL_CACHE "
|
||||||
MAKECOMMAND:STRING=nmake -i
|
MAKECOMMAND:STRING=nmake -i
|
||||||
CMAKE_MAKE_PROGRAM:FILEPATH=nmake
|
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}
|
BUILDNAME:STRING=${EIGEN_BUILD_STRING}
|
||||||
SITE:STRING=${EIGEN_SITE}
|
SITE:STRING=${EIGEN_SITE}
|
||||||
")
|
")
|
||||||
@ -172,10 +175,11 @@ else(WIN32 AND NOT UNIX)
|
|||||||
endif(WIN32 AND NOT UNIX)
|
endif(WIN32 AND NOT UNIX)
|
||||||
|
|
||||||
# set any extra environment variables to use during the execution of the script here:
|
# 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}")
|
set(CTEST_ENVIRONMENT "CXX=${EIGEN_CXX}")
|
||||||
endif(EIGEN_CXX)
|
endif(EIGEN_CXX AND NOT WIN32)
|
||||||
|
|
||||||
if(DEFINED EIGEN_EXPLICIT_VECTORIZATION)
|
if(DEFINED EIGEN_EXPLICIT_VECTORIZATION)
|
||||||
if(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE2)
|
if(EIGEN_EXPLICIT_VECTORIZATION MATCHES SSE2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user