Skip to content

Phydef#1313

Open
stevenrbrandt wants to merge 2 commits intomasterfrom
phydef
Open

Phydef#1313
stevenrbrandt wants to merge 2 commits intomasterfrom
phydef

Conversation

@stevenrbrandt
Copy link
Copy Markdown
Member

Add PhyDef:
PhyDef makes it possible to define two versions of the same function,
one that can be called from Phylanx and the other that can be called
from Python.

Example:

from phylanx import PhyDef
from numpy import zeros

with PhyDef("zeros"):
    @Phylanx
    def zeros(shape,dtype):
        return constant(0,shape,dtype)

a = zeros([3,3],dtype="float64") # call numpy zeros
a2 = zeros_phylanx([3,3],dtype="float64") # call phylanx zeros

@Phylanx
def foo():
    a = zeros([3,3],dtype="float64") # call phylanx zeros

Also add is_python() to allow routines to write code that evaluates differently inside or outside phylanx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants