Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/08/18 08:11:48 (5 years ago)
Author:
gkronber
Message:

#2915: merged all changes from branch to trunk

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/HeuristicLab.ExtLibs

  • trunk/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1/README.md

    r16274 r16356  
    1111- Visual Studio
    1212
    13     `cmake -G "Microsoft Visual 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.
    1414   
    1515    `cmake --build . --config Release`
  • trunk/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1/src/instruction.h

    r16269 r16356  
    2323    Root = 23,
    2424    Square = 28,
    25     Sqrt = 29
     25    Sqrt = 29,
     26    Absolute = 48,
     27    AnalyticalQuotient = 49,
     28    Cube = 50,
     29    CubeRoot = 51
    2630};
    2731
  • trunk/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1/src/interpreter.h

    r16334 r16356  
    1212        switch (in.opcode)
    1313        {
     14            case OpCodes::Const: /* nothing to do */ break;
    1415            case OpCodes::Var:
    1516                {
     
    100101                    break;
    101102                }
     103            case OpCodes::Sqrt:
     104                {
     105                    in.value = std::pow(code[in.childIndex].value, 1./2.);
     106                    break;
     107                }
    102108            case OpCodes::Square:
    103109                {
     
    105111                    break;
    106112                }
    107             case OpCodes::Sqrt:
    108                 {
    109                     in.value = std::sqrt(code[in.childIndex].value);
    110                     break;
    111                 }
     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::fabs(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;
    112136        }
    113137    }
     
    136160                    break;
    137161                }
     162            case OpCodes::Const: /* nothing to do because buffers for constants are already set */ break;
    138163            case OpCodes::Add:
    139164                {
     
    227252            case OpCodes::Square:
    228253                {
    229                     square(in.buf, code[in.childIndex].buf);
     254                    pow(in.buf, code[in.childIndex].buf, 2.);
    230255                    break;
    231256                }
    232257            case OpCodes::Sqrt:
    233258                {
    234                     sqrt(in.buf, code[in.childIndex].buf);
    235                     break;
    236                 }
    237         }
     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            }
    238285    }
    239286}
  • trunk/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/NativeInterpreter-0.1/src/vector_operations.h

    r16274 r16356  
    5353inline void inv(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = 1. / b[i]; }
    5454inline void neg(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = -b[i]; }
     55inline void abs(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] = std::fabs(b[i]); }
     56inline void analytical_quotient(double* __restrict a, double const * __restrict b) noexcept { FOR(i) a[i] /= hl_sqrt(b[i]*b[i] + 1.); }
    5557
    5658// vector - scalar operations
     
    6062inline void mul(double* __restrict a, double s) noexcept { FOR(i) a[i] *= s; }
    6163inline void div(double* __restrict a, double s) noexcept { FOR(i) a[i] /= s; }
     64inline void pow(double* __restrict dst, double const * __restrict src, double s) noexcept { FOR(i) dst[i] = hl_pow(src[i], s); }
    6265
    6366// vector operations
     
    6871inline void sin(double* __restrict a) noexcept { FOR(i) a[i] = hl_sin(a[i]); }
    6972inline void cos(double* __restrict a) noexcept { FOR(i) a[i] = hl_cos(a[i]); }
    70 inline void sqrt(double* __restrict a) noexcept { FOR(i) a[i] = hl_sqrt(a[i]); }
    7173inline void round(double* __restrict a) noexcept { FOR(i) a[i] = hl_round(a[i]); }
    7274inline 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.