Skip to content

Extend the input and output type? #3

@fanbin

Description

@fanbin

Hi,

I was thinking about registering custom input/return functions like:

static std::vector<float> aggregate(MathPresso::mreal_t x, MathPresso::mreal_t y) {
    std::vector<float> ret;
        ret.push_back(x);
        ret.push_back(y);
        ret.push_back(x+y);
        return ret;
}

// and then
 ctx.addFunction("agg", (void *) aggregate, MathPresso::MFUNC_F_ARG2);

Compiles OK, but as evaluated, the expression returns real type, which crashes of course.

Is there a way that I can define functions working on vector type?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions