mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-27 07:29:52 +08:00
03a956925a
Add a symCoeff() method to the Tensor class template that allows the user of the class to set multiple elements of a tensor at once if they are connected by a symmetry operation with respect to the tensor's indices (symmetry/antisymmetry/hermiticity/antihermiticity under echange of two indices and combination thereof for different pairs of indices). A compile-time resolution of the required symmetry groups via meta templates is also implemented. For small enough groups this is used to unroll the loop that goes through all the elements of the Tensor that are connected by this group. For larger groups or groups where the symmetries are defined at run time, a standard run-time implementation of the same algorithm is provided. For example, the following code completely initializes all elements of the totally antisymmetric tensor in three dimensions ('epsilon tensor'): SGroup<3, AntiSymmetry<0,1>, AntiSymmetry<1,2>> sym; Eigen::Tensor<double, 3> epsilon(3,3,3); epsilon.setZero(); epsilon.symCoeff(sym, 0, 1, 2) = 1;
105 lines
3.1 KiB
CMake
105 lines
3.1 KiB
CMake
|
|
set_property(GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT "Unsupported")
|
|
add_custom_target(BuildUnsupported)
|
|
|
|
include_directories(../../test ../../unsupported ../../Eigen
|
|
${CMAKE_CURRENT_BINARY_DIR}/../../test)
|
|
|
|
find_package(GoogleHash)
|
|
if(GOOGLEHASH_FOUND)
|
|
add_definitions("-DEIGEN_GOOGLEHASH_SUPPORT")
|
|
include_directories(${GOOGLEHASH_INCLUDES})
|
|
ei_add_property(EIGEN_TESTED_BACKENDS "GoogleHash, ")
|
|
else(GOOGLEHASH_FOUND)
|
|
ei_add_property(EIGEN_MISSING_BACKENDS "GoogleHash, ")
|
|
endif(GOOGLEHASH_FOUND)
|
|
|
|
find_package(Adolc)
|
|
if(ADOLC_FOUND)
|
|
include_directories(${ADOLC_INCLUDES})
|
|
ei_add_property(EIGEN_TESTED_BACKENDS "Adolc, ")
|
|
ei_add_test(forward_adolc "" ${ADOLC_LIBRARIES})
|
|
else(ADOLC_FOUND)
|
|
ei_add_property(EIGEN_MISSING_BACKENDS "Adolc, ")
|
|
endif(ADOLC_FOUND)
|
|
|
|
# this test seems to never have been successful on x87, so is considered to contain a FP-related bug.
|
|
# see thread: "non-linear optimization test summary"
|
|
ei_add_test(NonLinearOptimization)
|
|
|
|
ei_add_test(NumericalDiff)
|
|
ei_add_test(autodiff_scalar)
|
|
ei_add_test(autodiff)
|
|
|
|
if (NOT CMAKE_CXX_COMPILER MATCHES "clang\\+\\+$")
|
|
ei_add_test(BVH)
|
|
endif()
|
|
|
|
ei_add_test(matrix_exponential)
|
|
ei_add_test(matrix_function)
|
|
ei_add_test(matrix_power)
|
|
ei_add_test(matrix_square_root)
|
|
ei_add_test(alignedvector3)
|
|
ei_add_test(FFT)
|
|
|
|
find_package(MPFR 2.3.0)
|
|
find_package(GMP)
|
|
if(MPFR_FOUND)
|
|
include_directories(${MPFR_INCLUDES} ./mpreal)
|
|
ei_add_property(EIGEN_TESTED_BACKENDS "MPFR C++, ")
|
|
set(EIGEN_MPFR_TEST_LIBRARIES ${MPFR_LIBRARIES} ${GMP_LIBRARIES})
|
|
ei_add_test(mpreal_support "" "${EIGEN_MPFR_TEST_LIBRARIES}" )
|
|
else()
|
|
ei_add_property(EIGEN_MISSING_BACKENDS "MPFR C++, ")
|
|
endif()
|
|
|
|
ei_add_test(sparse_extra "" "")
|
|
|
|
find_package(FFTW)
|
|
if(FFTW_FOUND)
|
|
ei_add_property(EIGEN_TESTED_BACKENDS "fftw, ")
|
|
include_directories( ${FFTW_INCLUDES} )
|
|
if(FFTWL_LIB)
|
|
ei_add_test(FFTW "-DEIGEN_FFTW_DEFAULT -DEIGEN_HAS_FFTWL" "${FFTW_LIBRARIES}" )
|
|
else()
|
|
ei_add_test(FFTW "-DEIGEN_FFTW_DEFAULT" "${FFTW_LIBRARIES}" )
|
|
endif()
|
|
else()
|
|
ei_add_property(EIGEN_MISSING_BACKENDS "fftw, ")
|
|
endif()
|
|
|
|
option(EIGEN_TEST_NO_OPENGL "Disable OpenGL support in unit tests" OFF)
|
|
if(NOT EIGEN_TEST_NO_OPENGL)
|
|
find_package(OpenGL)
|
|
find_package(GLUT)
|
|
find_package(GLEW)
|
|
if(OPENGL_FOUND AND GLUT_FOUND AND GLEW_FOUND)
|
|
ei_add_property(EIGEN_TESTED_BACKENDS "OpenGL, ")
|
|
set(EIGEN_GL_LIB ${GLUT_LIBRARIES} ${GLEW_LIBRARIES})
|
|
ei_add_test(openglsupport "" "${EIGEN_GL_LIB}" )
|
|
else()
|
|
ei_add_property(EIGEN_MISSING_BACKENDS "OpenGL, ")
|
|
endif()
|
|
else()
|
|
ei_add_property(EIGEN_MISSING_BACKENDS "OpenGL, ")
|
|
endif()
|
|
|
|
ei_add_test(polynomialsolver)
|
|
ei_add_test(polynomialutils)
|
|
ei_add_test(kronecker_product)
|
|
ei_add_test(splines)
|
|
ei_add_test(gmres)
|
|
ei_add_test(minres)
|
|
ei_add_test(levenberg_marquardt)
|
|
ei_add_test(bdcsvd)
|
|
|
|
option(EIGEN_TEST_CXX11 "Enable testing of C++11 features (e.g. Tensor module)." OFF)
|
|
if(EIGEN_TEST_CXX11)
|
|
# FIXME: add C++11 compiler switch in some portable way
|
|
# (MSVC doesn't need any for example, so this will
|
|
# clash there)
|
|
ei_add_test(cxx11_meta "-std=c++0x")
|
|
ei_add_test(cxx11_tensor_simple "-std=c++0x")
|
|
ei_add_test(cxx11_tensor_symmetry "-std=c++0x")
|
|
endif()
|