def func(nops):
     ops = [ DiscreteDifferenceOperator(axis=axis,shapein=(2,3,4,5)) \
             for axis in range(nops) ]
     model = AdditionOperator(ops)
     assert model.T.T is model
     v = np.arange(2*3*4*5.).reshape(2,3,4,5)
     a = model.T(v)
     b = sum([op.T(v) for op in ops])
     c = model.T(v,v)
     assert np.all(a == b)
     assert np.all(b == c)
Beispiel #2
0
def test_composite():
    global counter
    counter = 0
    proxy_lists = [get_operator(proxy_list, attr)
                   for attr in ('', 'C', 'T', 'H', 'I', 'IC', 'IT', 'IH')]
    ref_lists = [get_operator(ref_list, attr)
                 for attr in ('', 'C', 'T', 'H', 'I', 'IC', 'IT', 'IH')]

    op = AdditionOperator(CompositionOperator(_) for _ in zip(*proxy_lists))
    ref = AdditionOperator(CompositionOperator(_) for _ in zip(*ref_lists))
    assert_same(op.todense(), ref.todense())
    assert_equal(counter, nproxy * op.shapein[0])
Beispiel #3
0
def test_composite():
    global counter
    counter = 0
    proxy_lists = [
        get_operator(proxy_list, attr)
        for attr in ('', 'C', 'T', 'H', 'I', 'IC', 'IT', 'IH')
    ]
    ref_lists = [
        get_operator(ref_list, attr)
        for attr in ('', 'C', 'T', 'H', 'I', 'IC', 'IT', 'IH')
    ]

    op = AdditionOperator(CompositionOperator(_) for _ in zip(*proxy_lists))
    ref = AdditionOperator(CompositionOperator(_) for _ in zip(*ref_lists))
    assert_same(op.todense(), ref.todense())
    assert_equal(counter, nproxy * op.shapein[0])
Beispiel #4
0
 def func(attr):
     op = AdditionOperator(get_operator(proxy_list, attr))
     ref = AdditionOperator(get_operator(ref_list, attr))
     assert_same(op.todense(), ref.todense())
Beispiel #5
0
 def func(attr):
     op = AdditionOperator(get_operator(proxy_list, attr))
     ref = AdditionOperator(get_operator(ref_list, attr))
     assert_same(op.todense(), ref.todense())