Changeset 2116 for trunk/brian/tests/testutils/test_sparse.py
- Timestamp:
- 08/10/10 17:18:06 (22 months ago)
- Files:
-
- 1 modified
-
trunk/brian/tests/testutils/test_sparse.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/brian/tests/testutils/test_sparse.py
r2020 r2116 1 1 from brian.connection import SparseMatrix 2 from numpy import zeros, array 2 3 from nose.tools import * 3 4 4 5 def test_sparse_matrix(): 5 6 x = SparseMatrix((10, 10)) 7 z = zeros((10, 10), dtype=int) 6 8 x[0, 4] = 3 7 9 x[1, :] = 5 … … 11 13 x[5, 2:4] = [1, 2] 12 14 x[6:8, 4:7] = 1 15 # same thing with z to compare 16 z[0, 4] = 3 17 z[1, :] = 5 18 z[2, []] = [] 19 z[3, [0]] = [6] 20 z[4, [0, 1]] = [7, 8] 21 z[5, 2:4] = [1, 2] 22 z[6:8, 4:7] = 1 23 # check the values are correct 24 y = array(x.todense(), dtype=int) 25 assert (y==z).all() 13 26 14 27 if __name__ == '__main__':
