Ejemplo n.º 1
0
def test_weighted_sum_sparse_2():
    """ Check link weighted sum computation, sparse """

    G1 = dana.zeros((3, 3))
    G2 = dana.ones((3, 3))
    G1.connect(G2, np.ones((3, 3)), 'I', sparse=True, shared=False)
    G1.dV = 'I-V'
    G1.compute()
    assert np_almost_equal(G1.V, np.array([[4, 6, 4], [6, 9, 6], [4, 6, 4]]))
Ejemplo n.º 2
0
def test_weighted_sum_sparse_1():
    """ Check link weighted sum computation, sparse """

    G1 = dana.zeros((5, ))
    G2 = dana.ones((5, ))
    G1.connect(G2, np.ones((5, )), 'I', sparse=True, shared=False)
    G1.dV = 'I-V'
    G1.compute()
    assert np_almost_equal(G1.V, np.array([3, 4, 5, 4, 3]))
Ejemplo n.º 3
0
def test_weighted_sum_sparse_1():
    """ Check link weighted sum computation, sparse """

    G1 = dana.zeros((5,))
    G2 = dana.ones((5,))
    G1.connect(G2,np.ones((5,)), 'I', sparse=True, shared=False)
    G1.dV = 'I-V'
    G1.compute()
    assert np_almost_equal(G1.V, np.array([3,4,5,4,3]))
Ejemplo n.º 4
0
def test_weighted_sum_sparse_3():
    """ Check link weighted sum computation, sparse, masked """

    G1 = dana.zeros((3, 3))
    G2 = dana.ones((3, 3))
    G1.connect(G2, np.ones((3, 3)), 'I', sparse=True, shared=False)
    G2.mask[1, 1] = False
    G1.dV = 'I-V'
    G1.compute()
    assert np_almost_equal(G1.V, np.array([[3, 5, 3], [5, 8, 5], [3, 5, 3]]))
Ejemplo n.º 5
0
def test_weighted_sum_sparse_2():
    """ Check link weighted sum computation, sparse """

    G1 = dana.zeros((3,3))
    G2 = dana.ones((3,3))
    G1.connect(G2,np.ones((3,3)), 'I', sparse=True, shared=False)
    G1.dV = 'I-V'
    G1.compute()
    assert np_almost_equal(G1.V, np.array([[4,6,4],
                                           [6,9,6],
                                           [4,6,4]]))
Ejemplo n.º 6
0
def test_weighted_sum_sparse_3():
    """ Check link weighted sum computation, sparse, masked """

    G1 = dana.zeros((3,3))
    G2 = dana.ones((3,3))
    G1.connect(G2,np.ones((3,3)), 'I', sparse=True, shared=False)
    G2.mask[1,1] = False
    G1.dV = 'I-V'
    G1.compute()
    assert np_almost_equal(G1.V, np.array([[3,5,3],
                                           [5,8,5],
                                           [3,5,3]]))