Changeset 16739 for branches/2994-AutoDiffForIntervals/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter
- Timestamp:
- 04/01/19 19:21:36 (6 years ago)
- Location:
- branches/2994-AutoDiffForIntervals
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2994-AutoDiffForIntervals
- Property svn:mergeinfo changed
/trunk merged: 16681,16700-16704,16706-16707,16716,16729,16737
- Property svn:mergeinfo changed
-
branches/2994-AutoDiffForIntervals/HeuristicLab.ExtLibs
- Property svn:mergeinfo changed
/trunk/HeuristicLab.ExtLibs (added) merged: 16701,16707
- Property svn:mergeinfo changed
-
branches/2994-AutoDiffForIntervals/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1
-
Property
svn:global-ignores
set to
build
mingw
-
Property
svn:global-ignores
set to
-
branches/2994-AutoDiffForIntervals/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1/src/instruction.h
r16356 r16739 9 9 { 10 10 // same values as in OpCodes.cs 11 Add = 1,12 Sub = 2,13 Mul = 3,14 Div = 4,15 Sin = 5,16 Cos = 6,17 Tan = 7,18 Log = 8,19 Exp = 9,20 Var = 18,21 Const = 20,22 Power = 22,23 Root = 23,24 Square = 28,25 Sqrt = 29,26 Absolute = 48,11 Add = 1, 12 Sub = 2, 13 Mul = 3, 14 Div = 4, 15 Sin = 5, 16 Cos = 6, 17 Tan = 7, 18 Log = 8, 19 Exp = 9, 20 Var = 18, 21 Const = 20, 22 Power = 22, 23 Root = 23, 24 Square = 28, 25 Sqrt = 29, 26 Absolute = 48, 27 27 AnalyticalQuotient = 49, 28 Cube = 50, 29 CubeRoot = 51 28 Cube = 50, 29 CubeRoot = 51, 30 Tanh = 52 30 31 }; 31 32 -
branches/2994-AutoDiffForIntervals/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1/src/interpreter.h
r16356 r16739 64 64 case OpCodes::Exp: 65 65 { 66 in.value = std::exp(code[in.childIndex].value);66 in.value = hl_exp(code[in.childIndex].value); 67 67 break; 68 68 } 69 69 case OpCodes::Log: 70 70 { 71 in.value = std::log(code[in.childIndex].value);71 in.value = hl_log(code[in.childIndex].value); 72 72 break; 73 73 } 74 74 case OpCodes::Sin: 75 75 { 76 in.value = std::sin(code[in.childIndex].value);76 in.value = hl_sin(code[in.childIndex].value); 77 77 break; 78 78 } 79 79 case OpCodes::Cos: 80 80 { 81 in.value = std::cos(code[in.childIndex].value);81 in.value = hl_cos(code[in.childIndex].value); 82 82 break; 83 83 } 84 84 case OpCodes::Tan: 85 85 { 86 in.value = std::tan(code[in.childIndex].value); 86 in.value = hl_tan(code[in.childIndex].value); 87 break; 88 } 89 case OpCodes::Tanh: 90 { 91 in.value = hl_tanh(code[in.childIndex].value); 87 92 break; 88 93 } … … 90 95 { 91 96 double x = code[in.childIndex].value; 92 double y = std::round(code[in.childIndex + 1].value);93 in.value = std::pow(x, y);97 double y = hl_round(code[in.childIndex + 1].value); 98 in.value = hl_pow(x, y); 94 99 break; 95 100 } … … 97 102 { 98 103 double x = code[in.childIndex].value; 99 double y = std::round(code[in.childIndex + 1].value);100 in.value = std::pow(x, 1 / y);104 double y = hl_round(code[in.childIndex + 1].value); 105 in.value = hl_pow(x, 1 / y); 101 106 break; 102 107 } 103 108 case OpCodes::Sqrt: 104 109 { 105 in.value = std::pow(code[in.childIndex].value, 1./2.);110 in.value = hl_pow(code[in.childIndex].value, 1./2.); 106 111 break; 107 112 } 108 113 case OpCodes::Square: 109 114 { 110 in.value = std::pow(code[in.childIndex].value, 2.);115 in.value = hl_pow(code[in.childIndex].value, 2.); 111 116 break; 112 117 } 113 118 case OpCodes::CubeRoot: 114 119 { 115 in.value = std::pow(code[in.childIndex].value, 1./3.);120 in.value = hl_pow(code[in.childIndex].value, 1./3.); 116 121 break; 117 122 } 118 123 case OpCodes::Cube: 119 124 { 120 in.value = std::pow(code[in.childIndex].value, 3.);125 in.value = hl_pow(code[in.childIndex].value, 3.); 121 126 break; 122 127 } … … 130 135 double x = code[in.childIndex].value; 131 136 double y = code[in.childIndex + 1].value; 132 in.value = x / std::sqrt(1 + y*y);137 in.value = x / hl_sqrt(1 + y*y); 133 138 break; 134 139 } … … 228 233 break; 229 234 } 235 case OpCodes::Tanh: 236 { 237 tanh(in.buf, code[in.childIndex].buf); 238 break; 239 } 230 240 case OpCodes::Log: 231 241 { -
branches/2994-AutoDiffForIntervals/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1/src/vector_operations.h
r16356 r16739 14 14 #define hl_cos vdt::fast_cos 15 15 #define hl_tan vdt::fast_tan 16 #define hl_tanh vdt::fast_tanh 16 17 #define hl_sqrt vdt::fast_sqrt 17 18 #define hl_pow vdt::fast_pow 18 19 #define hl_round vdt::fast_round 20 #define hl_inv vdt::fast_inv 19 21 #else 20 22 #define hl_exp std::exp … … 23 25 #define hl_cos std::cos 24 26 #define hl_tan std::tan 27 #define hl_tanh std::tanh 25 28 #define hl_sqrt std::sqrt 26 29 #define hl_pow std::pow 27 30 #define hl_round std::round 31 #define hl_inv(x) 1. / x; 32 28 33 #endif 29 34 … … 47 52 inline void cos(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = hl_cos(b[i]); } 48 53 inline void tan(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = hl_tan(b[i]); } 54 inline void tanh(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = hl_tanh(b[i]); } 49 55 inline void sqrt(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = hl_sqrt(b[i]); } 50 56 inline void pow(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = hl_pow(a[i], hl_round(b[i])); }; 51 57 inline void root(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = hl_pow(a[i], 1. / hl_round(b[i])); }; 52 58 inline void square(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = hl_pow(b[i], 2.); }; 53 inline void inv(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = 1. / b[i]; }59 inline void inv(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = hl_inv(b[i]); } 54 60 inline void neg(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = -b[i]; } 55 61 inline void abs(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = std::fabs(b[i]); } … … 66 72 // vector operations 67 73 inline void neg(double* __restrict a) noexcept { FOR(i) a[i] = -a[i]; } 68 inline void inv(double* __restrict a) noexcept { FOR(i) a[i] = 1. / a[i]; }74 inline void inv(double* __restrict a) noexcept { FOR(i) a[i] = hl_inv(a[i]); } 69 75 inline void exp(double* __restrict a) noexcept { FOR(i) a[i] = hl_exp(a[i]); } 70 76 inline void log(double* __restrict a) noexcept { FOR(i) a[i] = hl_log(a[i]); } 71 77 inline void sin(double* __restrict a) noexcept { FOR(i) a[i] = hl_sin(a[i]); } 72 78 inline void cos(double* __restrict a) noexcept { FOR(i) a[i] = hl_cos(a[i]); } 79 inline void tan(double* __restrict a) noexcept { FOR(i) a[i] = hl_tan(a[i]); } 80 inline void tanh(double* __restrict a) noexcept { FOR(i) a[i] = hl_tanh(a[i]); } 73 81 inline void round(double* __restrict a) noexcept { FOR(i) a[i] = hl_round(a[i]); } 74 82 inline void square(double* __restrict a) noexcept { FOR(i) a[i] = hl_pow(a[i], 2.); }
Note: See TracChangeset
for help on using the changeset viewer.