From b5068e3fc52f2bfb5659b38a7bc5ad2037b4e36f Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Tue, 12 May 2020 21:46:37 +0200 Subject: [PATCH] Refactor SD test: batch_optimizer_02 --- tests/symengine/batch_optimizer_02_1a.output | 24 +--- tests/symengine/batch_optimizer_02_1b.output | 24 +--- tests/symengine/batch_optimizer_02_2a.output | 24 +--- tests/symengine/batch_optimizer_02_2b.output | 24 +--- ...izer_02_3a.with_symengine_with_llvm.output | 24 +--- ..._3a.with_symengine_with_llvm.output.libc++ | 22 ---- ...izer_02_3b.with_symengine_with_llvm.output | 24 +--- ..._3b.with_symengine_with_llvm.output.libc++ | 22 ---- .../sd_common_tests/batch_optimizer_02.h | 114 +++++++++++++----- 9 files changed, 110 insertions(+), 192 deletions(-) delete mode 100644 tests/symengine/batch_optimizer_02_3a.with_symengine_with_llvm.output.libc++ delete mode 100644 tests/symengine/batch_optimizer_02_3b.with_symengine_with_llvm.output.libc++ diff --git a/tests/symengine/batch_optimizer_02_1a.output b/tests/symengine/batch_optimizer_02_1a.output index cee56ac015..fc25b8942e 100644 --- a/tests/symengine/batch_optimizer_02_1a.output +++ b/tests/symengine/batch_optimizer_02_1a.output @@ -1,22 +1,6 @@ -DEAL:Scalar:Float::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Float::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Float:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Float:Substitution::evaluation: s: 11.28968525 ds_dx: 2.440623999 -DEAL:Scalar:Float:Optimisation + substitution::evaluation: s: 11.28968525 ds_dx: 2.440623999 -DEAL:Scalar:Double::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Double::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Double:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Double:Substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Scalar:Double:Optimisation + substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Tensor:Float::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Float::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Float:Substitution::substitute: s: 733.14522057327 ds_dx: 1803.37506684305 ds_dy: 4021.22089917923 -2721.50016323639 -2073.1341017929 2076.40974260677 ds_dz: 1.67424568153838 1.97850294809826 1.97850294809826 2.6968452216256 -DEAL:Tensor:Float:Substitution::evaluation: s: 733.1452026 ds_dx: 1803.375122 ds_dy: 4021.220947 -2721.500244 -2073.134033 2076.409668 ds_dz: 1.674245715 1.978502989 1.978502989 2.696845293 -DEAL:Tensor:Float:Optimisation + substitution::evaluation: s: 733.1452026 ds_dx: 1803.375122 ds_dy: 4021.220947 -2721.500244 -2073.134033 2076.409668 ds_dz: 1.674245715 1.978502989 1.978502989 2.696845293 -DEAL:Tensor:Double::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Double::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Double:Substitution::substitute: s: 733.145160811002 ds_dx: 1803.37488238402 ds_dy: 4021.22068318209 -2721.5000393195 -2073.13387957114 2076.40954281835 ds_dz: 1.67425190103199 1.97851016739326 1.97851016739326 2.69685737072857 -DEAL:Tensor:Double:Substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 -DEAL:Tensor:Double:Optimisation + substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 +DEAL:Scalar:Float::OK +DEAL:Scalar:Double::OK +DEAL:Tensor:Float::OK +DEAL:Tensor:Double::OK DEAL::OK diff --git a/tests/symengine/batch_optimizer_02_1b.output b/tests/symengine/batch_optimizer_02_1b.output index 89f476547a..fc25b8942e 100644 --- a/tests/symengine/batch_optimizer_02_1b.output +++ b/tests/symengine/batch_optimizer_02_1b.output @@ -1,22 +1,6 @@ -DEAL:Scalar:Float::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Float::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Float:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Float:Substitution::evaluation: s: 11.28968525 ds_dx: 2.440623999 -DEAL:Scalar:Float:Optimisation + substitution::evaluation: s: 11.28968525 ds_dx: 2.440623999 -DEAL:Scalar:Double::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Double::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Double:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Double:Substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Scalar:Double:Optimisation + substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Tensor:Float::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Float::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Float:Substitution::substitute: s: 733.14522057327 ds_dx: 1803.37506684305 ds_dy: 4021.22089917923 -2721.50016323639 -2073.1341017929 2076.40974260677 ds_dz: 1.67424568153838 1.97850294809826 1.97850294809826 2.6968452216256 -DEAL:Tensor:Float:Substitution::evaluation: s: 733.1452026 ds_dx: 1803.375122 ds_dy: 4021.220947 -2721.500244 -2073.134033 2076.409668 ds_dz: 1.674245715 1.978502989 1.978502989 2.696845293 -DEAL:Tensor:Float:Optimisation + substitution::evaluation: s: 733.1452026 ds_dx: 1803.375122 ds_dy: 4021.220703 -2721.500000 -2073.134033 2076.409668 ds_dz: 1.674248815 1.978506565 1.978506565 2.696851254 -DEAL:Tensor:Double::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Double::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Double:Substitution::substitute: s: 733.145160811002 ds_dx: 1803.37488238402 ds_dy: 4021.22068318209 -2721.5000393195 -2073.13387957114 2076.40954281835 ds_dz: 1.67425190103199 1.97851016739326 1.97851016739326 2.69685737072857 -DEAL:Tensor:Double:Substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 -DEAL:Tensor:Double:Optimisation + substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 +DEAL:Scalar:Float::OK +DEAL:Scalar:Double::OK +DEAL:Tensor:Float::OK +DEAL:Tensor:Double::OK DEAL::OK diff --git a/tests/symengine/batch_optimizer_02_2a.output b/tests/symengine/batch_optimizer_02_2a.output index cee56ac015..fc25b8942e 100644 --- a/tests/symengine/batch_optimizer_02_2a.output +++ b/tests/symengine/batch_optimizer_02_2a.output @@ -1,22 +1,6 @@ -DEAL:Scalar:Float::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Float::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Float:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Float:Substitution::evaluation: s: 11.28968525 ds_dx: 2.440623999 -DEAL:Scalar:Float:Optimisation + substitution::evaluation: s: 11.28968525 ds_dx: 2.440623999 -DEAL:Scalar:Double::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Double::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Double:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Double:Substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Scalar:Double:Optimisation + substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Tensor:Float::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Float::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Float:Substitution::substitute: s: 733.14522057327 ds_dx: 1803.37506684305 ds_dy: 4021.22089917923 -2721.50016323639 -2073.1341017929 2076.40974260677 ds_dz: 1.67424568153838 1.97850294809826 1.97850294809826 2.6968452216256 -DEAL:Tensor:Float:Substitution::evaluation: s: 733.1452026 ds_dx: 1803.375122 ds_dy: 4021.220947 -2721.500244 -2073.134033 2076.409668 ds_dz: 1.674245715 1.978502989 1.978502989 2.696845293 -DEAL:Tensor:Float:Optimisation + substitution::evaluation: s: 733.1452026 ds_dx: 1803.375122 ds_dy: 4021.220947 -2721.500244 -2073.134033 2076.409668 ds_dz: 1.674245715 1.978502989 1.978502989 2.696845293 -DEAL:Tensor:Double::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Double::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Double:Substitution::substitute: s: 733.145160811002 ds_dx: 1803.37488238402 ds_dy: 4021.22068318209 -2721.5000393195 -2073.13387957114 2076.40954281835 ds_dz: 1.67425190103199 1.97851016739326 1.97851016739326 2.69685737072857 -DEAL:Tensor:Double:Substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 -DEAL:Tensor:Double:Optimisation + substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 +DEAL:Scalar:Float::OK +DEAL:Scalar:Double::OK +DEAL:Tensor:Float::OK +DEAL:Tensor:Double::OK DEAL::OK diff --git a/tests/symengine/batch_optimizer_02_2b.output b/tests/symengine/batch_optimizer_02_2b.output index cee56ac015..fc25b8942e 100644 --- a/tests/symengine/batch_optimizer_02_2b.output +++ b/tests/symengine/batch_optimizer_02_2b.output @@ -1,22 +1,6 @@ -DEAL:Scalar:Float::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Float::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Float:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Float:Substitution::evaluation: s: 11.28968525 ds_dx: 2.440623999 -DEAL:Scalar:Float:Optimisation + substitution::evaluation: s: 11.28968525 ds_dx: 2.440623999 -DEAL:Scalar:Double::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Double::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Double:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Double:Substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Scalar:Double:Optimisation + substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Tensor:Float::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Float::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Float:Substitution::substitute: s: 733.14522057327 ds_dx: 1803.37506684305 ds_dy: 4021.22089917923 -2721.50016323639 -2073.1341017929 2076.40974260677 ds_dz: 1.67424568153838 1.97850294809826 1.97850294809826 2.6968452216256 -DEAL:Tensor:Float:Substitution::evaluation: s: 733.1452026 ds_dx: 1803.375122 ds_dy: 4021.220947 -2721.500244 -2073.134033 2076.409668 ds_dz: 1.674245715 1.978502989 1.978502989 2.696845293 -DEAL:Tensor:Float:Optimisation + substitution::evaluation: s: 733.1452026 ds_dx: 1803.375122 ds_dy: 4021.220947 -2721.500244 -2073.134033 2076.409668 ds_dz: 1.674245715 1.978502989 1.978502989 2.696845293 -DEAL:Tensor:Double::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Double::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Double:Substitution::substitute: s: 733.145160811002 ds_dx: 1803.37488238402 ds_dy: 4021.22068318209 -2721.5000393195 -2073.13387957114 2076.40954281835 ds_dz: 1.67425190103199 1.97851016739326 1.97851016739326 2.69685737072857 -DEAL:Tensor:Double:Substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 -DEAL:Tensor:Double:Optimisation + substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 +DEAL:Scalar:Float::OK +DEAL:Scalar:Double::OK +DEAL:Tensor:Float::OK +DEAL:Tensor:Double::OK DEAL::OK diff --git a/tests/symengine/batch_optimizer_02_3a.with_symengine_with_llvm.output b/tests/symengine/batch_optimizer_02_3a.with_symengine_with_llvm.output index c3a6b4eaef..fc25b8942e 100644 --- a/tests/symengine/batch_optimizer_02_3a.with_symengine_with_llvm.output +++ b/tests/symengine/batch_optimizer_02_3a.with_symengine_with_llvm.output @@ -1,22 +1,6 @@ -DEAL:Scalar:Float::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Float::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Float:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Float:Substitution::evaluation: s: 11.28968525 ds_dx: 2.440623999 -DEAL:Scalar:Float:Optimisation + substitution::evaluation: s: 11.28968430 ds_dx: 2.440624714 -DEAL:Scalar:Double::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Double::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Double:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Double:Substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Scalar:Double:Optimisation + substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Tensor:Float::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Float::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Float:Substitution::substitute: s: 733.14522057327 ds_dx: 1803.37506684305 ds_dy: 4021.22089917923 -2721.50016323639 -2073.1341017929 2076.40974260677 ds_dz: 1.67424568153838 1.97850294809826 1.97850294809826 2.6968452216256 -DEAL:Tensor:Float:Substitution::evaluation: s: 733.1452026 ds_dx: 1803.375122 ds_dy: 4021.220947 -2721.500244 -2073.134033 2076.409668 ds_dz: 1.674245715 1.978502989 1.978502989 2.696845293 -DEAL:Tensor:Float:Optimisation + substitution::evaluation: s: 733.1455078 ds_dx: 1803.375977 ds_dy: 4021.222656 -2721.501465 -2073.135010 2076.410645 ds_dz: 1.674241662 1.978498340 1.978498340 2.696837425 -DEAL:Tensor:Double::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Double::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Double:Substitution::substitute: s: 733.145160811002 ds_dx: 1803.37488238402 ds_dy: 4021.22068318209 -2721.5000393195 -2073.13387957114 2076.40954281835 ds_dz: 1.67425190103199 1.97851016739326 1.97851016739326 2.69685737072857 -DEAL:Tensor:Double:Substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 -DEAL:Tensor:Double:Optimisation + substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 +DEAL:Scalar:Float::OK +DEAL:Scalar:Double::OK +DEAL:Tensor:Float::OK +DEAL:Tensor:Double::OK DEAL::OK diff --git a/tests/symengine/batch_optimizer_02_3a.with_symengine_with_llvm.output.libc++ b/tests/symengine/batch_optimizer_02_3a.with_symengine_with_llvm.output.libc++ deleted file mode 100644 index c1663180e2..0000000000 --- a/tests/symengine/batch_optimizer_02_3a.with_symengine_with_llvm.output.libc++ +++ /dev/null @@ -1,22 +0,0 @@ - -DEAL:Scalar:Float::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Float::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Float:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Float:Substitution::evaluation: s: 11.28968525 ds_dx: 2.440623999 -DEAL:Scalar:Float:Optimisation + substitution::evaluation: s: 11.28968430 ds_dx: 2.440624714 -DEAL:Scalar:Double::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Double::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Double:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Double:Substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Scalar:Double:Optimisation + substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Tensor:Float::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Float::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Float:Substitution::substitute: s: 733.14522057327 ds_dx: 1803.37506684305 ds_dy: 4021.22089917923 -2721.50016323639 -2073.1341017929 2076.40974260677 ds_dz: 1.67424568153838 1.97850294809826 1.97850294809826 2.6968452216256 -DEAL:Tensor:Float:Substitution::evaluation: s: 733.1452026 ds_dx: 1803.375122 ds_dy: 4021.220947 -2721.500244 -2073.134033 2076.409668 ds_dz: 1.674245715 1.978502989 1.978502989 2.696845293 -DEAL:Tensor:Float:Optimisation + substitution::evaluation: s: 733.1455078 ds_dx: 1803.375977 ds_dy: 4021.222900 -2721.501221 -2073.135010 2076.410889 ds_dz: 1.674248934 1.978506684 1.978506684 2.696851492 -DEAL:Tensor:Double::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Double::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Double:Substitution::substitute: s: 733.145160811002 ds_dx: 1803.37488238402 ds_dy: 4021.22068318209 -2721.5000393195 -2073.13387957114 2076.40954281835 ds_dz: 1.67425190103196 1.97851016739323 1.97851016739323 2.69685737072851 -DEAL:Tensor:Double:Substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 -DEAL:Tensor:Double:Optimisation + substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 -DEAL::OK diff --git a/tests/symengine/batch_optimizer_02_3b.with_symengine_with_llvm.output b/tests/symengine/batch_optimizer_02_3b.with_symengine_with_llvm.output index 6bbe1b7f9a..fc25b8942e 100644 --- a/tests/symengine/batch_optimizer_02_3b.with_symengine_with_llvm.output +++ b/tests/symengine/batch_optimizer_02_3b.with_symengine_with_llvm.output @@ -1,22 +1,6 @@ -DEAL:Scalar:Float::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Float::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Float:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Float:Substitution::evaluation: s: 11.28968525 ds_dx: 2.440623999 -DEAL:Scalar:Float:Optimisation + substitution::evaluation: s: 11.28968525 ds_dx: 2.440624475 -DEAL:Scalar:Double::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Double::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Double:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Double:Substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Scalar:Double:Optimisation + substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Tensor:Float::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Float::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Float:Substitution::substitute: s: 733.14522057327 ds_dx: 1803.37506684305 ds_dy: 4021.22089917923 -2721.50016323639 -2073.1341017929 2076.40974260677 ds_dz: 1.67424568153838 1.97850294809826 1.97850294809826 2.6968452216256 -DEAL:Tensor:Float:Substitution::evaluation: s: 733.1452026 ds_dx: 1803.375122 ds_dy: 4021.220947 -2721.500244 -2073.134033 2076.409668 ds_dz: 1.674245715 1.978502989 1.978502989 2.696845293 -DEAL:Tensor:Float:Optimisation + substitution::evaluation: s: 733.1455078 ds_dx: 1803.375977 ds_dy: 4021.222656 -2721.501465 -2073.134766 2076.410645 ds_dz: 1.674248934 1.978506684 1.978506684 2.696851492 -DEAL:Tensor:Double::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Double::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Double:Substitution::substitute: s: 733.145160811002 ds_dx: 1803.37488238402 ds_dy: 4021.22068318209 -2721.5000393195 -2073.13387957114 2076.40954281835 ds_dz: 1.67425190103199 1.97851016739326 1.97851016739326 2.69685737072857 -DEAL:Tensor:Double:Substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 -DEAL:Tensor:Double:Optimisation + substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 +DEAL:Scalar:Float::OK +DEAL:Scalar:Double::OK +DEAL:Tensor:Float::OK +DEAL:Tensor:Double::OK DEAL::OK diff --git a/tests/symengine/batch_optimizer_02_3b.with_symengine_with_llvm.output.libc++ b/tests/symengine/batch_optimizer_02_3b.with_symengine_with_llvm.output.libc++ deleted file mode 100644 index c2b05269dd..0000000000 --- a/tests/symengine/batch_optimizer_02_3b.with_symengine_with_llvm.output.libc++ +++ /dev/null @@ -1,22 +0,0 @@ - -DEAL:Scalar:Float::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Float::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Float:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Float:Substitution::evaluation: s: 11.28968525 ds_dx: 2.440623999 -DEAL:Scalar:Float:Optimisation + substitution::evaluation: s: 11.28968525 ds_dx: 2.440624237 -DEAL:Scalar:Double::symb_s: 1.5 + 1.5*y/log(x) + 2.0*x**y + sin(0.666666666666667*x*y**2) -DEAL:Scalar:Double::symb_ds_dx: 2.0*x**(-1 + y)*y + 0.666666666666667*y**2*cos(0.666666666666667*x*y**2) - 1.5*y/(x*log(x)**2) -DEAL:Scalar:Double:Substitution::substitute: s: 11.2896853345375 ds_dx: 2.44062401525716 -DEAL:Scalar:Double:Substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Scalar:Double:Optimisation + substitution::evaluation: s: 11.28968533 ds_dx: 2.440624015 -DEAL:Tensor:Float::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Float::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Float:Substitution::substitute: s: 733.14522057327 ds_dx: 1803.37506684305 ds_dy: 4021.22089917923 -2721.50016323639 -2073.1341017929 2076.40974260677 ds_dz: 1.67424568153838 1.97850294809826 1.97850294809826 2.6968452216256 -DEAL:Tensor:Float:Substitution::evaluation: s: 733.1452026 ds_dx: 1803.375122 ds_dy: 4021.220947 -2721.500244 -2073.134033 2076.409668 ds_dz: 1.674245715 1.978502989 1.978502989 2.696845293 -DEAL:Tensor:Float:Optimisation + substitution::evaluation: s: 733.1455078 ds_dx: 1803.375977 ds_dy: 4021.222656 -2721.501221 -2073.134766 2076.410645 ds_dz: 1.674248934 1.978506684 1.978506684 2.696851492 -DEAL:Tensor:Double::symb_s: 1.5 + 1.5*(1.0*y_00*y_11 - 1.0*y_01*y_10)*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10)) + sin(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) -DEAL:Tensor:Double::symb_ds_dy: 0.0 - 1.5*y_11 + 1.5*y_11*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_00*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_11 0.0 + 1.5*y_10 - 1.5*y_10*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_10 0.0 + 1.5*y_01 - 1.5*y_01*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_01*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) - 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_01 0.0 - 1.5*y_00 + 1.5*y_00*log(1.0*(z_00**2 + 2*z_01**2 + z_11**2)/(1.0*y_00*y_11 - 1.0*y_01*y_10)) + 0.666666666666667*z_11*cos(0.666666666666667*(z_00*y_00 + z_11*y_11 + 1.0*(y_01 + y_10)*z_01)) + 2.0*x**(1.0*(1.0*y_00*y_11 - 1.0*y_01*y_10))*log(x)*y_00 -DEAL:Tensor:Double:Substitution::substitute: s: 733.145160811002 ds_dx: 1803.37488238402 ds_dy: 4021.22068318209 -2721.5000393195 -2073.13387957114 2076.40954281835 ds_dz: 1.67425190103196 1.97851016739323 1.97851016739323 2.69685737072851 -DEAL:Tensor:Double:Substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 -DEAL:Tensor:Double:Optimisation + substitution::evaluation: s: 733.1451608 ds_dx: 1803.374882 ds_dy: 4021.220683 -2721.500039 -2073.133880 2076.409543 ds_dz: 1.674251901 1.978510167 1.978510167 2.696857371 -DEAL::OK diff --git a/tests/symengine/sd_common_tests/batch_optimizer_02.h b/tests/symengine/sd_common_tests/batch_optimizer_02.h index 75d73c8e54..092cd8148e 100644 --- a/tests/symengine/sd_common_tests/batch_optimizer_02.h +++ b/tests/symengine/sd_common_tests/batch_optimizer_02.h @@ -36,6 +36,9 @@ template (subs_s); const NumberType val_ds_dx = static_cast(subs_ds_dx); if (i == 0) - deallog << "evaluation: " - << " s: " << val_s << " ds_dx: " << val_ds_dx << std::endl; + std::cout << "evaluation: " + << " s: " << val_s << " ds_dx: " << val_ds_dx + << std::endl; } } deallog.pop(); @@ -99,11 +103,29 @@ test_scalar(const int n_runs, TimerOutput &timer) const NumberType val_s = optimizer.evaluate(symb_s); const NumberType val_ds_dx = optimizer.evaluate(symb_ds_dx); if (i == 0) - deallog << "evaluation: " - << " s: " << val_s << " ds_dx: " << val_ds_dx << std::endl; + std::cout << "evaluation: " + << " s: " << val_s << " ds_dx: " << val_ds_dx + << std::endl; + + // The result is not stable and depends on standard library, number + // type, optimization parameters and compiler being used. However, we + // also don't want to maintain a whole bunch of blesses output + // variants. So we set a loose tolerance here. + static const double tol = 1e-3; + { + const NumberType blessed_val_s = 11.2896853345; + const NumberType blessed_val_ds_dx = 2.44062401526; + + AssertThrow(std::abs(val_s - blessed_val_s) < tol, + ExcMessage("No match for function value.")); + AssertThrow(std::abs(val_ds_dx - blessed_val_ds_dx) < tol, + ExcMessage("No match for first derivative.")); + } } } deallog.pop(); + + deallog << "OK" << std::endl; } template SD_tensor_t; - typedef SymmetricTensor<2, dim, SD_number_t> SD_symm_tensor_t; + std::cout << std::string(80, '-') << std::endl; + std::cout << "Tensor: Dim: " << dim << std::endl; + + namespace SD = Differentiation::SD; + using SD_number_t = SD::Expression; + using SD_tensor_t = Tensor<2, dim, SD_number_t>; + using SD_symm_tensor_t = SymmetricTensor<2, dim, SD_number_t>; const NumberType a = NumberType(1.5); const SD_number_t x("x"); @@ -128,14 +153,14 @@ test_tensor(const int n_runs, TimerOutput &timer) a + NumberType(2.0) * std::pow(x, determinant(y)) + a * determinant(y) * std::log((z * z) / determinant(y)) + std::sin((z * symmetrize(y)) / a); - deallog << "symb_s: " << symb_s << std::endl; + std::cout << "symb_s: " << symb_s << std::endl; timer.leave_subsection("Value calculation"); timer.enter_subsection("Differentiation"); const SD_number_t symb_ds_dx = SD::differentiate(symb_s, x); const SD_tensor_t symb_ds_dy = SD::differentiate(symb_s, y); const SD_symm_tensor_t symb_ds_dz = SD::differentiate(symb_s, z); - deallog << "symb_ds_dy: " << symb_ds_dy << std::endl; + std::cout << "symb_ds_dy: " << symb_ds_dy << std::endl; timer.leave_subsection("Differentiation"); SD::types::substitution_map sub_vals; @@ -157,10 +182,10 @@ test_tensor(const int n_runs, TimerOutput &timer) const SD_symm_tensor_t subs_ds_dz = SD::substitute(symb_ds_dz, sub_vals); if (i == 0) - deallog << "substitute: " - << " s: " << subs_s << " ds_dx: " << subs_ds_dx - << " ds_dy: " << subs_ds_dy << " ds_dz: " << subs_ds_dz - << std::endl; + std::cout << "substitute: " + << " s: " << subs_s << " ds_dx: " << subs_ds_dx + << " ds_dy: " << subs_ds_dy << " ds_dz: " << subs_ds_dz + << std::endl; const NumberType val_s = static_cast(subs_s); const NumberType val_ds_dx = static_cast(subs_ds_dx); @@ -169,10 +194,41 @@ test_tensor(const int n_runs, TimerOutput &timer) const SymmetricTensor<2, dim, NumberType> val_ds_dz = static_cast>(subs_ds_dz); if (i == 0) - deallog << "evaluation: " - << " s: " << val_s << " ds_dx: " << val_ds_dx - << " ds_dy: " << val_ds_dy << " ds_dz: " << val_ds_dz - << std::endl; + std::cout << "evaluation: " + << " s: " << val_s << " ds_dx: " << val_ds_dx + << " ds_dy: " << val_ds_dy << " ds_dz: " << val_ds_dz + << std::endl; + + // The result is not stable and depends on standard library, number + // type, optimization parameters and compiler being used. However, we + // also don't want to maintain a whole bunch of blesses output + // variants. So we set a loose tolerance here. + static const double tol = 1e-3; + if (dim == 2) + { + const NumberType blessed_val_s = 733.145160811; + const NumberType blessed_val_ds_dx = 1803.37488238; + const Tensor<2, dim, NumberType> blessed_val_ds_dy( + {{4021.22068318, -2721.50003932}, + {-2073.13387957, 2076.40954282}}); + const SymmetricTensor<2, dim, NumberType> blessed_val_ds_dz = + symmetrize( + Tensor<2, dim, NumberType>({{1.67425190103, 1.97851016739}, + {1.97851016739, 2.69685737073}})); + + AssertThrow(std::abs(val_s - blessed_val_s) < tol, + ExcMessage("No match for function value.")); + AssertThrow(std::abs(val_ds_dx - blessed_val_ds_dx) < tol, + ExcMessage("No match for first derivative.")); + AssertThrow((val_ds_dy - blessed_val_ds_dy).norm() < tol, + ExcMessage("No match for first derivative.")); + AssertThrow((val_ds_dz - blessed_val_ds_dz).norm() < tol, + ExcMessage("No match for first derivative.")); + } + else + { + AssertThrow(false, ExcNotImplemented()); + } } } deallog.pop(); @@ -210,13 +266,15 @@ test_tensor(const int n_runs, TimerOutput &timer) optimizer.evaluate(symb_ds_dz); if (i == 0) - deallog << "evaluation: " - << " s: " << val_s << " ds_dx: " << val_ds_dx - << " ds_dy: " << val_ds_dy << " ds_dz: " << val_ds_dz - << std::endl; + std::cout << "evaluation: " + << " s: " << val_s << " ds_dx: " << val_ds_dx + << " ds_dy: " << val_ds_dy << " ds_dz: " << val_ds_dz + << std::endl; } } deallog.pop(); + + deallog << "OK" << std::endl; } @@ -228,7 +286,7 @@ run_tests(const int n_runs) { // Show the difference between a SymEngine "value" and // an evaluated, floating point number - // deallog << std::setprecision(3); + // deallog << std::setprecision(12); deallog.push("Scalar"); { -- 2.39.5