- Timestamp:
- 12/07/18 19:51:23 (6 years ago)
- Location:
- branches/2915-AbsoluteSymbol/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2915-AbsoluteSymbol/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1/README.md
r16274 r16349 11 11 - Visual Studio 12 12 13 `cmake -G " MicrosoftVisual Studio 15 2017 [arch]" <path-to-repository>`. Leave `arch` empty for x86 or `Win64` for x64.13 `cmake -G "Visual Studio 15 2017 [arch]" <path-to-repository>`. Leave `arch` empty for x86 or `Win64` for x64. 14 14 15 15 `cmake --build . --config Release` -
branches/2915-AbsoluteSymbol/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1/src/instruction.h
r16269 r16349 23 23 Root = 23, 24 24 Square = 28, 25 Sqrt = 29 25 Sqrt = 29, 26 Absolute = 48, 27 AnalyticalQuotient = 49, 28 Cube = 50, 29 CubeRoot = 51 26 30 }; 27 31 -
branches/2915-AbsoluteSymbol/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1/src/interpreter.h
r16274 r16349 12 12 switch (in.opcode) 13 13 { 14 case OpCodes::Const: /* nothing to do */ break; 14 15 case OpCodes::Var: 15 16 { … … 105 106 break; 106 107 } 108 case OpCodes::Square: 109 { 110 in.value = std::pow(code[in.childIndex].value, 2.); 111 break; 112 } 113 case OpCodes::CubeRoot: 114 { 115 in.value = std::pow(code[in.childIndex].value, 1./3.); 116 break; 117 } 118 case OpCodes::Cube: 119 { 120 in.value = std::pow(code[in.childIndex].value, 3.); 121 break; 122 } 123 case OpCodes::Absolute: 124 { 125 in.value = std::abs(code[in.childIndex].value); 126 break; 127 } 128 case OpCodes::AnalyticalQuotient: 129 { 130 double x = code[in.childIndex].value; 131 double y = code[in.childIndex + 1].value; 132 in.value = x / std::sqrt(1 + y*y); 133 break; 134 } 135 default: in.value = NAN; 107 136 } 108 137 } … … 131 160 break; 132 161 } 162 case OpCodes::Const: /* nothing to do because buffers for constants are already set */ break; 133 163 case OpCodes::Add: 134 164 { … … 222 252 case OpCodes::Square: 223 253 { 224 square(in.buf, code[in.childIndex].buf); 225 break; 226 } 227 } 254 pow(in.buf, code[in.childIndex].buf, 2.); 255 break; 256 } 257 case OpCodes::Sqrt: 258 { 259 pow(in.buf, code[in.childIndex].buf, 1./2.); 260 break; 261 } 262 case OpCodes::CubeRoot: 263 { 264 pow(in.buf, code[in.childIndex].buf, 1./3.); 265 break; 266 } 267 case OpCodes::Cube: 268 { 269 pow(in.buf, code[in.childIndex].buf, 3.); 270 break; 271 } 272 case OpCodes::Absolute: 273 { 274 abs(in.buf, code[in.childIndex].buf); 275 break; 276 } 277 case OpCodes::AnalyticalQuotient: 278 { 279 load(in.buf, code[in.childIndex].buf); 280 analytical_quotient(in.buf, code[in.childIndex + 1].buf); 281 break; 282 } 283 default: load(in.buf, NAN); 284 } 228 285 } 229 286 } -
branches/2915-AbsoluteSymbol/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1/src/vector_operations.h
r16274 r16349 53 53 inline void inv(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = 1. / b[i]; } 54 54 inline void neg(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = -b[i]; } 55 inline void abs(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = std::abs(b[i]); } 56 inline void analytical_quotient(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] /= hl_sqrt(b[i]*b[i] + 1.); } 55 57 56 58 // vector - scalar operations … … 60 62 inline void mul(double* __restrict a, double s) noexcept { FOR(i) a[i] *= s; } 61 63 inline void div(double* __restrict a, double s) noexcept { FOR(i) a[i] /= s; } 64 inline void pow(double* __restrict dst, double const * __restrict src, double s) noexcept { FOR(i) dst[i] = hl_pow(src[i], s); } 62 65 63 66 // vector operations
Note: See TracChangeset
for help on using the changeset viewer.