Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phydef #1313

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Phydef #1313

wants to merge 2 commits into from

Conversation

stevenrbrandt
Copy link
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