[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/hsutter/cppfront/main/include/cpp2taylor.h2 [Back]  [Original]

#ifndef CPP2_CPP2TAYLOR_H
#define CPP2_CPP2TAYLOR_H

cpp2: namespace = {

taylor:  type  = {
    public v : std::array = ();

    operator=:(out this) = {}
    operator=:(out this, d1: R) = {
        v = ();
        v[0] = d1;
    }
    operator=:(out this, that) = {}

    operator=:(out this, l: std::initializer_list) = {
        (copy i := 1)
        for l do (cur) {
            set(i, cur);
        }
    }

    // C++ interface

    operator[]: (this, k: int) -> R = {
        assert(1  taylor = {
        return sub(o, 0.0, 0.0); // Primal values are not required.
    }

    // Overload for simple handling of prefix +.
    operator+: (this) -> taylor = {
        return this;
    }

    // Overload for simple handling of prefix -.
    operator-: (this) -> taylor = {
        r: taylor = ();

        (copy k:= 1)
        while k  taylor = {
        r: taylor = ();

        (copy k:= 1)
        while k  taylor = {
        r: taylor = ();

        (copy k:= 1)
        while k  taylor = {
        dim_r : int == std::max(dim, dim_o);
        r: taylor = ();

        (copy k:= 1)
        while k 

Web Proxy Viewer  |  New URL  |  Original Page