Skip to content

discussion of opDef provided to an nFunction #117

@paciorek

Description

@paciorek

I am not understanding how one provides a user-defined opDef to an nFunction (and more generally to an nClass).

I think I mostly get how one provides a global user-defined opDef.

However, I thought one should be able to do something like this.

nimArray2_opDef <- nCompiler:::getOperatorDef("nimArray")  # presume `nimArray` operator is set up as in `test-userOps.R`.
foo = nFunction(
    function() {
        ans <- nimArray2( 6, dim = 2)
        return(ans)
        returnType('double(1)')
    },
    compileInfo = list(opDef = list(nimArray2 = nimArray2_opDef))
)
cfoo <- nCompile(foo)
An error occurred in compiler stage normalizeCalls:
No operator definition found for nimArray2.

where nimArray2 is my new operator and I want to say how it is handled by providing the opDef as part of compileInfo.

Note that I would think the opDef value provided should be a named list, so that the opDef info for nArray2 can be found. But that is not what is done in the examples in the "nFunction custom opDef works through a sequence of changes and handlers" test in test-userOps.R, so clearly I am not understanding something here.

This could be a placeholder for a direct discussion with @perrydv .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions