Ticket #3 (closed defect: fixed)
Setting sparse matrix with function f(i,j) doesn't work on scipy 0.7.1
| Reported by: | thesamovar | Owned by: | thesamovar |
|---|---|---|---|
| Priority: | blocker | Milestone: | 1.2 |
| Component: | Core | Version: | 1.1.3 |
| Keywords: | Cc: |
Description (last modified by thesamovar) (diff)
The following code doesn't work:
Ce=Connection(Ge, G, 'ge', weight=lambda i,j: rand(),
delay=lambda i,j: rand()*(max_delay-min_delay)+min_delay,
sparseness=prob_conn)
The reason appears to be a bug in scipy 0.7.1 (not present in 0.7.0) sparse matrix support. If you try the following:
x = lil_matrix((5,5)) x[0,[]] = [] x[0,[0]] = [1] x[0,[0,1]] = [1,2]
Only the last one works. The first raises a problem with shape, the second with setting an element with a sequence. All of these should work I think.
This could be fixed in Brian probably, but maybe we should consider one of:
- changing sparse matrix library (investigate others)
- dedicate some resources to improving scipy sparse matrix support
- add another patch to Brian to work around this bug
- write our own sparse matrix library from scratch (possibly with limited functionality)
Change History
Note: See
TracTickets for help on using
tickets.
