diff --git a/.travis.yml b/.travis.yml index f53ea49074..01bb2f8ab1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,743 +27,753 @@ matrix: - env: BOGUS_JOB=true include: - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03 TEST_SUITE=special_fun - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11 TEST_SUITE=special_fun - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14 TEST_SUITE=special_fun - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z TEST_SUITE=special_fun - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03 TEST_SUITE=distribution_tests - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11 TEST_SUITE=distribution_tests - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14 TEST_SUITE=distribution_tests - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z TEST_SUITE=distribution_tests - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03 TEST_SUITE=quadrature - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11 TEST_SUITE=quadrature - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14 TEST_SUITE=quadrature - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=gnu++14 TEST_SUITE=quadrature - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z TEST_SUITE=quadrature - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03 TEST_SUITE=float128_tests - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11 TEST_SUITE=float128_tests - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14 TEST_SUITE=float128_tests - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=gnu++14 TEST_SUITE=float128_tests - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z TEST_SUITE=float128_tests - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03 TEST_SUITE=../example//examples - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03 TEST_SUITE=../tools - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11 TEST_SUITE=../example//examples - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11 TEST_SUITE=../tools - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14 TEST_SUITE=../example//examples - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14 TEST_SUITE=../tools - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=gnu++14 TEST_SUITE=../example//examples - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=gnu++14 TEST_SUITE=../tools - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z TEST_SUITE=../example//examples - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z TEST_SUITE=../tools - addons: - apt: - packages: - - g++-6 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14 TEST_SUITE=special_fun - addons: - apt: - packages: - - g++-5 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14 TEST_SUITE=distribution_tests - addons: - apt: - packages: - - g++-5 - - libgmp-dev - - libmpfr-dev - - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14 TEST_SUITE=misc + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03 TEST_SUITE=special_fun + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11 TEST_SUITE=special_fun + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14 TEST_SUITE=special_fun + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z TEST_SUITE=special_fun + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03 TEST_SUITE=distribution_tests + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11 TEST_SUITE=distribution_tests + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14 TEST_SUITE=distribution_tests + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z TEST_SUITE=distribution_tests + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + - os: linux + env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03 TEST_SUITE="quadrature include=/usr/include/eigen3" addons: apt: packages: - - g++-5 + - g++-6 - libgmp-dev - libmpfr-dev - libfftw3-dev + - libeigen3-dev sources: - ubuntu-toolchain-r-test - os: linux - env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14 TEST_SUITE=quadrature + env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11 TEST_SUITE="quadrature include=/usr/include/eigen3" addons: apt: packages: - - g++-5 + - g++-6 - libgmp-dev - libmpfr-dev - libfftw3-dev + - libeigen3-dev sources: - ubuntu-toolchain-r-test - os: linux - env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14 TEST_SUITE=float128_tests + env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14 TEST_SUITE="quadrature include=/usr/include/eigen3" addons: apt: packages: - - g++-5 + - g++-6 - libgmp-dev - libmpfr-dev - libfftw3-dev + - libeigen3-dev sources: - ubuntu-toolchain-r-test - os: linux - env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14 TEST_SUITE=../example//examples + env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=gnu++14 TEST_SUITE="quadrature include=/usr/include/eigen3" addons: apt: packages: - - g++-5 + - g++-6 - libgmp-dev - libmpfr-dev - libfftw3-dev + - libeigen3-dev sources: - ubuntu-toolchain-r-test - os: linux - env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14 TEST_SUITE=../tools + env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z TEST_SUITE="quadrature include=/usr/include/eigen3" addons: apt: packages: - - g++-5 + - g++-6 - libgmp-dev - libmpfr-dev - libfftw3-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=c++14 TEST_SUITE=special_fun - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=c++14 TEST_SUITE=distribution_tests - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=c++14 TEST_SUITE=misc - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=c++14 TEST_SUITE=quadrature - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=c++14 TEST_SUITE=float128_tests - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=c++14 TEST_SUITE=../example//examples - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=c++14 TEST_SUITE=../tools - addons: - apt: - packages: - - g++-8 - - libgmp-dev - - libmpfr-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++03 TEST_SUITE=special_fun - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++03 TEST_SUITE=distribution_tests - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++03 TEST_SUITE=misc - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++03 TEST_SUITE=quadrature - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++03 TEST_SUITE=float128_tests - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++03 TEST_SUITE=../example//examples - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++03 TEST_SUITE=../tools + - libeigen3-dev + sources: + - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03 TEST_SUITE=float128_tests + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11 TEST_SUITE=float128_tests + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14 TEST_SUITE=float128_tests + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=gnu++14 TEST_SUITE=float128_tests + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z TEST_SUITE=float128_tests + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03 TEST_SUITE=../example//examples + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03 TEST_SUITE=../tools + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11 TEST_SUITE=../example//examples + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11 TEST_SUITE=../tools + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14 TEST_SUITE=../example//examples + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14 TEST_SUITE=../tools + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=gnu++14 TEST_SUITE=../example//examples + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=gnu++14 TEST_SUITE=../tools + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z TEST_SUITE=../example//examples + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z TEST_SUITE=../tools + # addons: + # apt: + # packages: + # - g++-6 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14 TEST_SUITE=special_fun + # addons: + # apt: + # packages: + # - g++-5 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14 TEST_SUITE=distribution_tests + # addons: + # apt: + # packages: + # - g++-5 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14 TEST_SUITE=misc + # addons: + # apt: + # packages: + # - g++-5 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + - os: linux + env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14 TEST_SUITE="quadrature include=/usr/include/eigen3" addons: apt: packages: - - g++-8 + - g++-5 - libgmp-dev - libmpfr-dev - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++17 TEST_SUITE=special_fun - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++17 TEST_SUITE=distribution_tests - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++17 TEST_SUITE=quadrature - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test + - libfftw3-dev + - libeigen3-dev + sources: + - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14 TEST_SUITE=float128_tests + # addons: + # apt: + # packages: + # - g++-5 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14 TEST_SUITE=../example//examples + # addons: + # apt: + # packages: + # - g++-5 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14 TEST_SUITE=../tools + # addons: + # apt: + # packages: + # - g++-5 + # - libgmp-dev + # - libmpfr-dev + # - libfftw3-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=c++14 TEST_SUITE=special_fun + # addons: + # apt: + # packages: + # - g++-8 + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=c++14 TEST_SUITE=distribution_tests + # addons: + # apt: + # packages: + # - g++-8 + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=c++14 TEST_SUITE=misc + # addons: + # apt: + # packages: + # - g++-8 + # sources: + # - ubuntu-toolchain-r-test - os: linux dist: trusty compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++17 TEST_SUITE=float128_tests + env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=c++14 TEST_SUITE="quadrature include=/usr/include/eigen3" addons: apt: packages: - g++-8 - sources: - - ubuntu-toolchain-r-test + - libeigen3-dev + sources: + - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=c++14 TEST_SUITE=float128_tests + # addons: + # apt: + # packages: + # - g++-8 + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=c++14 TEST_SUITE=../example//examples + # addons: + # apt: + # packages: + # - g++-8 + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=c++14 TEST_SUITE=../tools + # addons: + # apt: + # packages: + # - g++-8 + # - libgmp-dev + # - libmpfr-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++03 TEST_SUITE=special_fun + # addons: + # apt: + # packages: + # - g++-8 + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++03 TEST_SUITE=distribution_tests + # addons: + # apt: + # packages: + # - g++-8 + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++03 TEST_SUITE=misc + # addons: + # apt: + # packages: + # - g++-8 + # sources: + # - ubuntu-toolchain-r-test - os: linux dist: trusty compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++17 TEST_SUITE=../example//examples + env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++03 TEST_SUITE="quadrature include=/usr/include/eigen3" addons: apt: packages: - g++-8 - sources: - - ubuntu-toolchain-r-test + - libeigen3-dev + sources: + - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++03 TEST_SUITE=float128_tests + # addons: + # apt: + # packages: + # - g++-8 + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++03 TEST_SUITE=../example//examples + # addons: + # apt: + # packages: + # - g++-8 + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++03 TEST_SUITE=../tools + # addons: + # apt: + # packages: + # - g++-8 + # - libgmp-dev + # - libmpfr-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++17 TEST_SUITE=special_fun + # addons: + # apt: + # packages: + # - g++-8 + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++17 TEST_SUITE=distribution_tests + # addons: + # apt: + # packages: + # - g++-8 + # sources: + # - ubuntu-toolchain-r-test - os: linux dist: trusty compiler: g++-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++17 TEST_SUITE=../tools + env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++17 TEST_SUITE="quadrature include=/usr/include/eigen3" addons: apt: packages: - g++-8 - - libgmp-dev - - libmpfr-dev - sources: - - ubuntu-toolchain-r-test + - libeigen3-dev + sources: + - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++17 TEST_SUITE=float128_tests + # addons: + # apt: + # packages: + # - g++-8 + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++17 TEST_SUITE=../example//examples + # addons: + # apt: + # packages: + # - g++-8 + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # dist: trusty + # compiler: g++-8 + # env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=gnu++17 TEST_SUITE=../tools + # addons: + # apt: + # packages: + # - g++-8 + # - libgmp-dev + # - libmpfr-dev + # sources: + # - ubuntu-toolchain-r-test + + # - os: linux + # compiler: clang++-6.0 + # env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=c++11 TEST_SUITE=special_fun + # addons: + # apt: + # packages: + # - clang-6.0 + # sources: + # - ubuntu-toolchain-r-test + # - llvm-toolchain-xenial-6.0 + + # - os: linux + # compiler: clang++-6.0 + # env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=c++11 TEST_SUITE=distribution_tests + # addons: + # apt: + # packages: + # - clang-6.0 + # sources: + # - ubuntu-toolchain-r-test + # - llvm-toolchain-xenial-6.0 + + # - os: linux + # compiler: clang++-6.0 + # env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=c++11 TEST_SUITE=misc + # addons: + # apt: + # packages: + # - clang-6.0 + # sources: + # - ubuntu-toolchain-r-test + # - llvm-toolchain-xenial-6.0 - os: linux compiler: clang++-6.0 - env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=c++11 TEST_SUITE=special_fun + env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=c++11 TEST_SUITE="quadrature include=/usr/include/eigen3" addons: apt: packages: - clang-6.0 + - libeigen3-dev sources: - ubuntu-toolchain-r-test - llvm-toolchain-xenial-6.0 - - os: linux - compiler: clang++-6.0 - env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=c++11 TEST_SUITE=distribution_tests - addons: - apt: - packages: - - clang-6.0 - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-xenial-6.0 - - - os: linux - compiler: clang++-6.0 - env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=c++11 TEST_SUITE=misc - addons: - apt: - packages: - - clang-6.0 - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-xenial-6.0 - - - os: linux - compiler: clang++-6.0 - env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=c++11 TEST_SUITE=quadrature - addons: - apt: - packages: - - clang-6.0 - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-xenial-6.0 - - - os: linux - compiler: clang++-6.0 - env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=c++11 TEST_SUITE=../example//examples - addons: - apt: - packages: - - clang-6.0 - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-xenial-6.0 - - - os: linux - compiler: clang++-6.0 - env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=c++11 TEST_SUITE=../tools - addons: - apt: - packages: - - clang-6.0 - - libgmp-dev - - libmpfr-dev - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-xenial-6.0 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14 TEST_SUITE=special_fun - osx_image: xcode11 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14 TEST_SUITE=distribution_tests - osx_image: xcode11 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14 TEST_SUITE=misc - osx_image: xcode11 + # - os: linux + # compiler: clang++-6.0 + # env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=c++11 TEST_SUITE=../example//examples + # addons: + # apt: + # packages: + # - clang-6.0 + # sources: + # - ubuntu-toolchain-r-test + # - llvm-toolchain-xenial-6.0 + + # - os: linux + # compiler: clang++-6.0 + # env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=c++11 TEST_SUITE=../tools + # addons: + # apt: + # packages: + # - clang-6.0 + # - libgmp-dev + # - libmpfr-dev + # sources: + # - ubuntu-toolchain-r-test + # - llvm-toolchain-xenial-6.0 + + # - os: osx + # env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14 TEST_SUITE=special_fun + # osx_image: xcode11 + + # - os: osx + # env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14 TEST_SUITE=distribution_tests + # osx_image: xcode11 + + # - os: osx + # env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14 TEST_SUITE=misc + # osx_image: xcode11 - os: osx env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14 TEST_SUITE=quadrature osx_image: xcode11 - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14 TEST_SUITE=float128_tests - osx_image: xcode11 + # - os: osx + # env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14 TEST_SUITE=float128_tests + # osx_image: xcode11 - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14 TEST_SUITE=../example//examples - osx_image: xcode11 + # - os: osx + # env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14 TEST_SUITE=../example//examples + # osx_image: xcode11 install: diff --git a/include/boost/math/differentiation/autodiff_eigen.hpp b/include/boost/math/differentiation/autodiff_eigen.hpp new file mode 100644 index 0000000000..1c7c44f977 --- /dev/null +++ b/include/boost/math/differentiation/autodiff_eigen.hpp @@ -0,0 +1,59 @@ +#ifndef BOOST_MATH_DIFFERENTIATION_AUTODIFF_EIGEN_HPP +#define BOOST_MATH_DIFFERENTIATION_AUTODIFF_EIGEN_HPP + +#include +#include + +namespace Eigen { +template +struct NumTraits> : NumTraits { + using fvar = + boost::math::differentiation::autodiff_v1::detail::template fvar; + + enum { + RequireInitialization = 1, + ReadCost = 1, + AddCost = 16, + MulCost = 16, + }; +}; + +template +struct ScalarBinaryOpTraits, + A, BinaryOp> { + typedef boost::math::differentiation::autodiff_v1::detail::template fvar< + RealType, Order> + ReturnType; +}; + +template +struct ScalarBinaryOpTraits, + BinaryOp> { + typedef boost::math::differentiation::autodiff_v1::detail::template fvar< + RealType, Order> + ReturnType; +}; + +template +struct ScalarBinaryOpTraits< + boost::math::differentiation::autodiff_v1::detail::template fvar, + boost::math::differentiation::autodiff_v1::detail::template fvar, + BinaryOp> { + typedef ScalarBinaryOpTraits::ReturnType + RealReturn; + const size_t ReturnOrder = (Order > Order2) ? Order : Order2; + typedef boost::math::differentiation::autodiff_v1::detail::template fvar< + RealReturn, ReturnOrder> + ReturnType; +} +} // namespace Eigen + +#endif // BOOST_MATH_DIFFERENTIATION_AUTODIFF_EIGEN_HPP diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 60dc9c154d..f8c80f3b0a 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -1334,6 +1334,7 @@ test-suite quadrature : [ run test_autodiff_6.cpp ../../test/build//boost_unit_test_framework : : : gcc-mingw:-Wa,-mbig-obj off msvc:/bigobj release [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : -lquadmath ] [ requires cxx11_inline_namespaces ] ] [ run test_autodiff_7.cpp ../../test/build//boost_unit_test_framework : : : gcc-mingw:-Wa,-mbig-obj off msvc:/bigobj release [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : -lquadmath ] [ requires cxx11_inline_namespaces ] ] [ run test_autodiff_8.cpp ../../test/build//boost_unit_test_framework : : : gcc-mingw:-Wa,-mbig-obj off msvc:/bigobj release [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : -lquadmath ] [ requires cxx11_inline_namespaces ] ] + [ run test_autodiff_9.cpp ../../test/build//boost_unit_test_framework : : : gcc-mingw:-Wa,-mbig-obj off msvc:/bigobj release [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : -lquadmath ] [ requires cxx11_inline_namespaces ] ] [ compile compile_test/autodiff_incl_test.cpp : gcc-mingw:-Wa,-mbig-obj off msvc:/bigobj release [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : -lquadmath ] [ requires cxx11_inline_namespaces ] ] ; diff --git a/test/test_autodiff_9.cpp b/test/test_autodiff_9.cpp new file mode 100644 index 0000000000..926ef24449 --- /dev/null +++ b/test/test_autodiff_9.cpp @@ -0,0 +1,229 @@ +#include +#include + +#include "test_autodiff.hpp" + +BOOST_AUTO_TEST_SUITE(test_autodiff_9) + +BOOST_AUTO_TEST_CASE_TEMPLATE(eigen_init, T, all_float_types) { + constexpr int size = 5; + + constexpr std::size_t n = 5; + typedef typename fvar fTn; + Eigen::Matrix x; + x[0] = fTn(1.5); + x[1] = make_fvar(2.5); + x[2] = fvar(3.5); + x[3] = 4; + x[4] = 5.5; + + constexpr std::size_t m = 2; + typedef typename fvar fTm; + Eigen::Matrix y; + y = x.template cast(); + BOOST_CHECK_EQUAL(x[0].derivative(0), y[0].derivative(0)); + BOOST_CHECK_EQUAL(x[1].derivative(0), y[1].derivative(0)); + BOOST_CHECK_EQUAL(x[2].derivative(0), y[2].derivative(0)); + BOOST_CHECK_EQUAL(x[3].derivative(0), y[3].derivative(0)); + BOOST_CHECK_EQUAL(x[4].derivative(0), y[4].derivative(0)); + + constexpr std::size_t p = 3; + typedef typename fvar fTp; + Eigen::Matrix z = + Eigen::Matrix::Random().transpose().template cast(); +} + +BOOST_AUTO_TEST_CASE_TEMPLATE(eigen_general, T, all_float_types) { + using std::cos; + using std::exp; + using std::log; + using std::pow; + using std::sin; + + constexpr int dim = 3; + constexpr std::size_t n = 2; + constexpr double p = 3.456; + + typedef typename fvar fTn; + Eigen::Matrix x; + x[0] = -1; + x[1] = 0; + x[2] = 1; + x[3] = 5; + + Eigen::Matrix y1, y2, y3, y4, y5; + y1 = sin(x); + y2 = cos(x); + y3 = exp(x); + y4 = pow(x, p); + y5 = log(x); + + // Check sin + BOOST_CHECK_EQUAL(y1[0].derivative(0), sin(x[0].derivative(0))); + BOOST_CHECK_EQUAL(y1[1].derivative(0), sin(x[1].derivative(0))); + BOOST_CHECK_EQUAL(y1[2].derivative(0), sin(x[2].derivative(0))); + BOOST_CHECK_EQUAL(y1[3].derivative(0), sin(x[3].derivative(0))); + BOOST_CHECK_EQUAL(y1[0].derivative(1), cos(x[0].derivative(0))); + BOOST_CHECK_EQUAL(y1[1].derivative(1), cos(x[1].derivative(0))); + BOOST_CHECK_EQUAL(y1[2].derivative(1), cos(x[2].derivative(0))); + BOOST_CHECK_EQUAL(y1[3].derivative(1), cos(x[3].derivative(0))); + BOOST_CHECK_EQUAL(y1[0].derivative(2), -sin(x[0].derivative(0))); + BOOST_CHECK_EQUAL(y1[1].derivative(2), -sin(x[1].derivative(0))); + BOOST_CHECK_EQUAL(y1[2].derivative(2), -sin(x[2].derivative(0))); + BOOST_CHECK_EQUAL(y1[3].derivative(2), -sin(x[3].derivative(0))); + + // Check cos + BOOST_CHECK_EQUAL(y2[0].derivative(0), cos(x[0].derivative(0))); + BOOST_CHECK_EQUAL(y2[1].derivative(0), cos(x[1].derivative(0))); + BOOST_CHECK_EQUAL(y2[2].derivative(0), cos(x[2].derivative(0))); + BOOST_CHECK_EQUAL(y2[3].derivative(0), cos(x[3].derivative(0))); + BOOST_CHECK_EQUAL(y2[0].derivative(1), -sin(x[0].derivative(0))); + BOOST_CHECK_EQUAL(y2[1].derivative(1), -sin(x[1].derivative(0))); + BOOST_CHECK_EQUAL(y2[2].derivative(1), -sin(x[2].derivative(0))); + BOOST_CHECK_EQUAL(y2[3].derivative(1), -sin(x[3].derivative(0))); + BOOST_CHECK_EQUAL(y2[0].derivative(2), -cos(x[0].derivative(0))); + BOOST_CHECK_EQUAL(y2[1].derivative(2), -cos(x[1].derivative(0))); + BOOST_CHECK_EQUAL(y2[2].derivative(2), -cos(x[2].derivative(0))); + BOOST_CHECK_EQUAL(y2[3].derivative(2), -cos(x[3].derivative(0))); + + // Check exp + BOOST_CHECK_EQUAL(y3[0].derivative(0), exp(x[0].derivative(0))); + BOOST_CHECK_EQUAL(y3[1].derivative(0), exp(x[1].derivative(0))); + BOOST_CHECK_EQUAL(y3[2].derivative(0), exp(x[2].derivative(0))); + BOOST_CHECK_EQUAL(y3[3].derivative(0), exp(x[3].derivative(0))); + BOOST_CHECK_EQUAL(y3[0].derivative(1), exp(x[0].derivative(0))); + BOOST_CHECK_EQUAL(y3[1].derivative(1), exp(x[1].derivative(0))); + BOOST_CHECK_EQUAL(y3[2].derivative(1), exp(x[2].derivative(0))); + BOOST_CHECK_EQUAL(y3[3].derivative(1), exp(x[3].derivative(0))); + BOOST_CHECK_EQUAL(y3[0].derivative(2), exp(x[0].derivative(0))); + BOOST_CHECK_EQUAL(y3[1].derivative(2), exp(x[1].derivative(0))); + BOOST_CHECK_EQUAL(y3[2].derivative(2), exp(x[2].derivative(0))); + BOOST_CHECK_EQUAL(y3[3].derivative(2), exp(x[3].derivative(0))); + + // Check pow + BOOST_CHECK_EQUAL(y4[0].derivative(0), pow(x[0].derivative(0), p)); + BOOST_CHECK_EQUAL(y4[1].derivative(0), pow(x[1].derivative(0), p)); + BOOST_CHECK_EQUAL(y4[2].derivative(0), pow(x[2].derivative(0), p)); + BOOST_CHECK_EQUAL(y4[3].derivative(0), pow(x[3].derivative(0), p)); + BOOST_CHECK_EQUAL(y4[0].derivative(1), p * pow(x[0].derivative(0), p - 1)); + BOOST_CHECK_EQUAL(y4[1].derivative(1), p * pow(x[1].derivative(0), p - 1)); + BOOST_CHECK_EQUAL(y4[2].derivative(1), p * pow(x[2].derivative(0), p - 1)); + BOOST_CHECK_EQUAL(y4[3].derivative(1), p * pow(x[3].derivative(0), p - 1)); + BOOST_CHECK_EQUAL(y4[0].derivative(2), + (p - 1) * p * pow(x[0].derivative(0), p - 2)); + BOOST_CHECK_EQUAL(y4[1].derivative(2), + (p - 1) * p * pow(x[1].derivative(0), p - 2)); + BOOST_CHECK_EQUAL(y4[2].derivative(2), + (p - 1) * p * pow(x[2].derivative(0), p - 2)); + BOOST_CHECK_EQUAL(y4[3].derivative(2), + (p - 1) * p * pow(x[3].derivative(0), p - 2)); + + // Check log + BOOST_CHECK_EQUAL(y5[2].derivative(0), log(x[0].derivative(0)); + BOOST_CHECK_EQUAL(y5[3].derivative(0), log(x[3].derivative(0)); + BOOST_CHECK_EQUAL(y5[2].derivative(1), 1/x[2].derivative(0)); + BOOST_CHECK_EQUAL(y5[3].derivative(1), 1/x[3].derivative(0)); + BOOST_CHECK_EQUAL(y5[2].derivative(2), -1/pow(x[2].derivative(0), 2)); + BOOST_CHECK_EQUAL(y5[3].derivative(2), -1/pow(x[3].derivative(0), 2)); +} + +BOOST_AUTO_TEST_CASE_TEMPLATE(eigen_scalar, T, all_float_types) { + constexpr int dim = 4; + constexpr size_t n = 4; + + typedef typename fvar fTn; + fTn x = 4; + Eigen::Matrix X; + Eigen::Matrix Z; + Eigen::Matrix I = Eigen::Matrix::Identity(); + X[0] = x; + Z[0] = x; + X[1] = 2; + Z[1] = x; + X[2] = x; + Z[2] = -3; + X[3] = 4; + Z[3] = 5; + + // y = x*x + 2*x - 3*x + 20 + fTn y1 = X.transpose() * Z; + fTn y2 = Z.transpose() * I * X; + + BOOST_CHECK_EQUAL(y1.derivative(0), x * x + 2 * x - 3 * x + 20); + BOOST_CHECK_EQUAL(y1.derivative(1), 2 * x - 1); + BOOST_CHECK_EQUAL(y1.derivative(2), 2); + BOOST_CHECK_EQUAL(y1.derivative(3), 0); + BOOST_CHECK_EQUAL(y1.derivative(4), 0); + BOOST_CHECK_EQUAL(y2.derivative(0), x * x + 2 * x - 3 * x + 20); + BOOST_CHECK_EQUAL(y2.derivative(1), 2 * x - 1); + BOOST_CHECK_EQUAL(y2.derivative(2), 2); + BOOST_CHECK_EQUAL(y2.derivative(3), 0); + BOOST_CHECK_EQUAL(y2.derivative(4), 0); +} + +BOOST_AUTO_TEST_CASE_TEMPLATE(eigen_vector, T, all_float_types) { + // Note: Can't handle taking gradient all at once. That would require the same + // approach as `make_ftuple`, which has upper limits. + using std::cos; + using std::sin; + + constexpr int dim = 3; + constexpr size_t n = 4; + + typedef typename fvar fTn; + fTn x = 5; + T xD0 = x.derivative(0); + Eigen::Matrix X; + X[0] = 1; + X[1] = x; + X[2] = x * x; + Eigen::Matrix M; + M(0, 0) = 1; + M(0, 1) = 2; + M(0, 2) = x; + M(1, 0) = 1 / x; + M(1, 1) = 4; + M(1, 2) = 0; + M(2, 0) = 5; + M(2, 1) = sin(x); + M(2, 2) = cos(x * x); + + Eigen::Matrix Y = M * X; + + // Y[0] = 1 + 2*x + x*x*x + BOOST_CHECK_EQUAL(Y[0].derivative(0), 1 + 2 * xD0 + pow(xD0, 3)); + BOOST_CHECK_EQUAL(Y[0].derivative(1), 2 + 3 * xD0 * xD0); + BOOST_CHECK_EQUAL(Y[0].derivative(2), 6 * xD0); + BOOST_CHECK_EQUAL(Y[0].derivative(3), 6); + BOOST_CHECK_EQUAL(Y[0].derivative(4), 0); + + // Y[1] = 1/x + 4*x + 0 + BOOST_CHECK_EQUAL(Y[1].derivative(0), 1 / xD0 + 4 * xD0); + BOOST_CHECK_EQUAL(Y[1].derivative(1), -1 / (xD0 * xD0) + 4); + BOOST_CHECK_EQUAL(Y[1].derivative(2), 2 / (pow(xD0, 3))); + BOOST_CHECK_EQUAL(Y[1].derivative(3), -6 / (pow(xD0, 3) * xD0)); + BOOST_CHECK_EQUAL(Y[1].derivative(4), 24 / (pow(xD0, 3) * xD0 * xD0)); + + // Y[2] = 5 + x*sin(x) + x*x*cos(x*x) + BOOST_CHECK_EQUAL(Y[2].derivative(0), + 5 + xD0 * sin(xD0) + xD0 * xD0 * cos(xD0 * xD0)); + BOOST_CHECK_EQUAL(Y[2].derivative(1), 2 * xD0 * cos(xD0 * xD0) - + 2 * pow(xD0, 3) * sin(xD0 * xD0) + + sin(xD0) + xD0 * cos(xD0)); + BOOST_CHECK_EQUAL(Y[2].derivative(2), + -xD0 * (10 * xD0 * sin(xD0 * xD0) + sin(xD0)) + + (2 - 4 * pow(xD0, 4)) * cos(xD0 * xD0) + 2 * cos(xD0)); + BOOST_CHECK_EQUAL(Y[2].derivative(3), -24 * xD0 * sin(xD0 * xD0) + + 8 * pow(xD0, 5) * sin(xD0 * xD0) - + 36 * pow(xD0, 3) * cos(xD0 * xD0) - + 3 * sin(xD0) - xD0 * cos(xD0)); + BOOST_CHECK_EQUAL( + Y[2].derivative(4), + -24 * sin(xD0 * xD0) + 112 * pow(xD0, 4) * sin(xD0 * xD0) + + 4 * (4 * pow(xD0, 4) - 39) * xD0 * xD0 * cos(xD0 * xD0) + + xD0 * sin(xD0) - 4 * cos(xD0)); +} + +// BOOST_AUTO_TEST_CASE_TEMPLATE(eigen_determinant, T, all_float_types) { +// constexpr int dim = 4; +// }