ctn-waterloo/nengo_spinnaker — pull request #61 by mundya (2014-06-12 08:40:36+00:00)
Title: Decoder Neatening

I've implemented some decoder caching, but we can remove that when it's merged in in Nengo upstream. More importantly this PR knocks zeroed columns out of decoders before merging them together, i.e., we don't bother including dimensions for which no neuron contributes any output, the result is a saving in memory, packets and time!

- The function `get_compressed_decoder` takes a decoder and returns a list of dimensions which weren't knocked out, and the decoder with those columns removed (I love Numpy sometimes)
- The function `get_combined_compressed_decoders` basically does the same thing but zips the dimension numbers with an index and an optional header. The index represents the index that will be represented in the multicast packet key (hence the connection index), and the header is for anything else useful (which will likely be the KeySpace stuff I'm due to work on).
- Decoder caching is pretty trivial, you create a `DecoderBuilder` with reference to a function you want to use to build the decoder (i.e., that generates activities, calls the solver, etc.), and then call the `DecoderBuilder` to `get_transformed_decoder(function, transform, eval_points, solver)` to get the transformed decoder. Like I say, we can kill this when it's merged-in in Nengo.

Git has done a really horrible job of formatting this...