79 lines
1.4 KiB
Python

import numpy as np
from .carry import Carry
xy_2 = Carry([[2,-1],[-1,0]])
xy_3 = Carry([[3,-1],[-1,0]])
x2y_3 = Carry([[3,-2],[-1,0]])
x3y_4 = Carry([[4,-3],[-1,0]])
laplace = Carry([[0,-1,0],[-1,4,-1],[0,-1,0]])
laplace3 = Carry([[0,0,0],[-1,3,-1],[0,-1,0]])
almost_folium = Carry([[0,0,-1], [0,2,0], [-1,0,0]])
folium = Carry([
[ 0,0,0,-1],
[ 0,2,0, 0],
[ 0,0,0, 0],
[-1,0,0, 0]
])
folium3 = Carry([
[ 0,0,0,-1],
[ 0,3,0, 0],
[ 0,0,0, 0],
[-1,0,0, 0]
])
folium4 = Carry([
[ 0, 0, 0,-1, 0],
[ 0, 0, 0, 0,-1],
[ 0, 0, 4, 0, 0],
[-1, 0, 0, 0, 0],
[ 0,-1, 0, 0, 0]
])
def triangle_spread(n):
ret = np.zeros((n + 1, n + 1), dtype=np.int32)
ret[0, 0] = -1
ret[1, 1] = 3
ret[n, 0] = -1
ret[0, n] = -1
return ret
triangle1 = Carry(triangle_spread(1))
triangle2 = Carry(triangle_spread(2))
triangle3 = Carry(triangle_spread(3)) #factorable!
triangle4 = Carry(triangle_spread(4))
tri3_rot = Carry([
[ 0, 0,-1, 0, 0],
[ 0, 0, 3, 0, 0],
[-1, 0, 0, 0,-1]
])
tri3_rot_real = Carry([
[ 0, 0, 0,-1, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 3, 0, 0, 0],
[-1, 0, 0, 0, 0, 0,-1]
])
tri3_rot2 = Carry([
[ 0,-1, 0],
[ 0, 3, 0],
[-1, 0,-1]
])
tri3_tall = Carry([
[ 0,-1, 0],
[ 0, 0, 0],
[ 0, 3, 0],
[-1, 0,-1]
])
tri3_tall2 = Carry([
[ 0,-1, 0],
[ 0, 3, 0],
[ 0, 0, 0],
[-1, 0,-1]
])