Skip to content

Commit

Permalink
ok yeah
Browse files Browse the repository at this point in the history
  • Loading branch information
vmchale committed Feb 22, 2025
1 parent b8ddc9f commit 478417d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/py/py.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,16 @@ def unstring(isbn):
maxpool2d=apple.jit("([(⋉)/* _1e314 (x::M float)] ⨳ {2∘2,2∘2})")
maxpool2d(A)
assert ((maxpool2d(A)==np.array([[200.,119.],[120.,49.]])).all())

hexagon=apple.jit('''
λ𝜃.
{
hex ⟜ ⟨(3%2,√3%2),(0,√3),(_3%2,√3%2),(_3%2,_(√3)%2),(0,_(√3)),(3%2,_(√3)%2)⟩;
tie ← [{.x⊳x];
rot ← λ𝜃.λ(𝑥,𝑦). (𝑥*cos.𝜃-𝑦*sin.𝜃,𝑥*sin.𝜃+𝑦*cos.𝜃);
-- T ← λk.λl.λ(x,y). (x+3*k+(3%2)*l,y+(√3%2)*l);
tie (rot 𝜃'hex)
}''')
expected=np.array([(1.5,0.8660254),(0.,1.73205081),(-1.5,0.8660254),(-1.5,-0.8660254),(0.,-1.73205081),(1.5,-0.8660254),(1.5,0.8660254)], dtype="f8,f8")
actual=hexagon(0)
print(expected);print(actual)

0 comments on commit 478417d

Please sign in to comment.