Exemplo n.º 1
0
def make_c4_p4_indices(ksize):
    x = np.random.randn(4, ksize, ksize) # 4 relates to stabilizer size of input channel
    f = P4FuncArray(v=x) # input channel related
    li = f.left_translation_indices(C4[:, None, None, None])
    if ksize % 2 == 0:
        li = f.left_translation_indices(C4_halfshift[:, None, None, None]) # this adds the output channel stabilizer # output channel related\
    return li.astype('int32')
Exemplo n.º 2
0
def make_c4_p4_indices(ksize):
    x = np.random.randn(4, ksize, ksize)
    f = P4FuncArray(v=x)

    if ksize % 2 == 0:
        li = f.left_translation_indices(C4_halfshift[:, None, None, None])
    else:
        li = f.left_translation_indices(C4[:, None, None, None])
    return li.astype('int32')
Exemplo n.º 3
0
def test_p4_func():
    from groupy.gfunc.p4func_array import P4FuncArray
    import groupy.garray.C4_array as c4a

    v = np.random.randn(2, 6, 4, 5, 5)
    f = P4FuncArray(v=v)

    g = c4a.rand(size=(1, ))
    h = c4a.rand(size=(1, ))

    check_associative(g, h, f)
    check_identity(c4a, f)
    check_invertible(g, f)
    check_i2g_g2i_invertible(f)
Exemplo n.º 4
0
 def rotate_p4_func(f, r):
     f = P4FuncArray(f)
     rot = C4Array([r], 'int')
     rot_f = rot * f
     return rot_f.v