forked from blaze/blaze
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Large amount of documentation about functional specialization and ATe…
…rm matching
- Loading branch information
Showing
8 changed files
with
105 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
import numpy as np | ||
|
||
from blaze.expr.ops import array_like | ||
from blaze.expr.paterm import ATerm, AAppl, AInt | ||
from blaze.rts.ffi import install, lift, lookup | ||
from blaze.rts.funcs import install, lift, lookup | ||
|
||
from unittest import skip | ||
from blaze import add, multiply | ||
|
||
def test_install(): | ||
from unittest import skip | ||
|
||
def test_match1(): | ||
expr = AAppl(ATerm('Add'), [AInt(1), AInt(2)]) | ||
fn, cost = lookup(expr) | ||
|
||
assert fn.fn == np.add | ||
assert cost == 0 | ||
assert fn.fn == add.fn.im_func | ||
|
||
def test_match2(): | ||
expr = AAppl(ATerm('Mul'), [ATerm('Array'), ATerm('Array')]) | ||
fn, cost = lookup(expr) | ||
|
||
if __name__ == '__main__': | ||
test_install() | ||
assert fn.fn == multiply.fn.im_func |