Exemple #1
0
def test_one_to_one_dense_3():
    """ Check link computation, one to one, dense """

    G1 = dana.group(np.random.random((5, 5)))
    G2 = dana.group(np.random.random((10, 10)))
    G1.connect(G2, np.ones((1, 1)), 'I', sparse=False, shared=False)
    G1.dV = 'I-V'
    G1.compute()
    assert np_almost_equal(G1.V, G2.V[::2, ::2])
Exemple #2
0
def test_one_to_one_shared_1():
    """ Check link computation, one to one, shared """

    G1 = dana.group(np.random.random((10, )))
    G2 = dana.group(np.random.random((10, )))
    G1.connect(G2, np.ones((1, )), 'I', sparse=False, shared=True)
    G1.dV = 'I-V'
    G1.compute()
    assert np_almost_equal(G1.V, G2.V)
Exemple #3
0
def test_one_to_one_dense_3():
    """ Check link computation, one to one, dense """

    G1 = dana.group(np.random.random((5,5)))
    G2 = dana.group(np.random.random((10,10)))
    G1.connect(G2, np.ones((1,1)), 'I', sparse=False, shared=False)
    G1.dV = 'I-V'
    G1.compute()
    assert np_almost_equal(G1.V,G2.V[::2,::2])
Exemple #4
0
def test_one_to_one_shared_1():
    """ Check link computation, one to one, shared """

    G1 = dana.group(np.random.random((10,)))
    G2 = dana.group(np.random.random((10,)))
    G1.connect(G2, np.ones((1,)), 'I', sparse=False, shared=True)
    G1.dV = 'I-V'
    G1.compute()
    assert np_almost_equal(G1.V,G2.V)
Exemple #5
0
def test_one_to_one_dense_5():
    """ Check link, one to one, dense """

    G1 = dana.group(np.random.random((10, 10)))
    G2 = dana.group(np.random.random((10, 10)))
    G1.connect(G2, np.ones((1, 1)), 'I', sparse=False, shared=False)
    W = G1.I[0, 0]
    Z = np.ones((10, 10)) * np.NaN
    Z[0, 0] = 1
    assert np_almost_equal(W, Z)
Exemple #6
0
def test_one_to_one_shared_4():
    """ Check link, one to one, shared """

    G1 = dana.group(np.random.random((10, )))
    G2 = dana.group(np.random.random((10, )))
    G1.connect(G2, np.ones((1, )), 'I', sparse=False, shared=True)
    W = G1.I[0]
    Z = np.ones((10, )) * np.NaN
    Z[0] = 1
    assert np_almost_equal(W, Z)
Exemple #7
0
def test_one_to_one_dense_5():
    """ Check link, one to one, dense """

    G1 = dana.group(np.random.random((10,10)))
    G2 = dana.group(np.random.random((10,10)))
    G1.connect(G2, np.ones((1,1)), 'I', sparse=False, shared=False)
    W = G1.I[0,0]
    Z = np.ones((10,10))*np.NaN
    Z[0,0] = 1
    assert np_almost_equal(W,Z)
Exemple #8
0
def test_one_to_one_shared_4():
    """ Check link, one to one, shared """

    G1 = dana.group(np.random.random((10,)))
    G2 = dana.group(np.random.random((10,)))
    G1.connect(G2, np.ones((1,)), 'I', sparse=False, shared=True)
    W = G1.I[0]
    Z = np.ones((10,))*np.NaN
    Z[0] = 1
    assert np_almost_equal(W,Z)
Exemple #9
0
def test_one_to_one_dense_6():
    """ Check link computation, one to one, dense, masked """

    G1 = dana.group(np.random.random((10, )))
    G2 = dana.group(np.random.random((10, )))
    G1.connect(G2, np.ones((1, )), 'I', sparse=False, shared=False)
    G1.mask[0] = False
    G1.dV = 'I-V'
    G1.compute()
    G2.V[0] = 0
    assert np_almost_equal(G1.V, G2.V)
Exemple #10
0
def test_one_to_one_sparse_7():
    """ Check link, one to one, sparse """

    G1 = dana.group(np.random.random((10, 10)))
    G2 = dana.group(np.random.random((10, 10)))
    G1.connect(G2, np.ones((1, 1)), 'I', sparse=True, shared=False)
    G1.mask[0, 0] = False
    G1.dV = 'I-V'
    G1.compute()
    G2.V[0, 0] = 0
    assert np_almost_equal(G1.V, G2.V)
Exemple #11
0
def test_one_to_one_dense_7():
    """ Check link computation, one to one, dense, masked """

    G1 = dana.group(np.random.random((10,10)))
    G2 = dana.group(np.random.random((10,10)))
    G1.connect(G2, np.ones((1,1)), 'I', sparse=False, shared=False)
    G1.mask[0,0] = False
    G1.dV = 'I-V'
    G1.compute()
    G2.V[0,0] = 0
    assert np_almost_equal(G1.V,G2.V)
Exemple #12
0
def test_one_to_one_sparse_6():
    """ Check link, one to one, sparse """

    G1 = dana.group(np.random.random((10,)))
    G2 = dana.group(np.random.random((10,)))
    G1.connect(G2, np.ones((1,)), 'I', sparse=True, shared=False)
    G1.mask[0] = False
    G1.dV = 'I-V'
    G1.compute()
    G2.V[0] = 0
    assert np_almost_equal(G1.V,G2.V)
Exemple #13
0
def test_distance_sparse_2():
    """ Check link distance computation, sparse """

    G1 = dana.zeros((5, 5))
    G2 = dana.group(np.random.random((5, 5)))
    G1.connect(G2, np.ones((1, 1)), 'I-', sparse=True, shared=False)
    G1.dV = 'I'
    G1.compute()
    assert np_almost_equal(G1.V, 1 - G2.V)
Exemple #14
0
def test_distance_sparse_2():
    """ Check link distance computation, sparse """

    G1 = dana.zeros((5,5))
    G2 = dana.group(np.random.random((5,5)))
    G1.connect(G2, np.ones((1,1)), 'I-', sparse=True, shared=False)
    G1.dV = 'I'
    G1.compute()
    assert np_almost_equal(G1.V,1-G2.V)