Oblynx / HierarchicalTemporalMemory.jl

A simple, high-level Julia implementation of Numenta HTM algorithms
https://oblynx.github.io/HierarchicalTemporalMemory.jl
MIT License
21 stars 3 forks source link

No .= for SparseSynapses #3

Closed Oblynx closed 5 years ago

Oblynx commented 5 years ago

This probably optimizes mutation. To try with base SparseMatrixCSC first.

ERROR: LoadError: ArgumentError: invalid index: (1, 1) of type Tuple{Int64,Int64}
Stacktrace:
 [1] to_index(::Tuple{Int64,Int64}) at ./indices.jl:270
 [2] to_index(::Main.SpatialPoolerM.SparseSynapses{2,2,4}, ::Tuple{Int64,Int64}) at ./indices.jl:247
 [3] to_indices at ./indices.jl:298 [inlined] (repeats 2 times)
 [4] to_indices at ./indices.jl:294 [inlined]
 [5] view at ./subarray.jl:154 [inlined]
 [6] maybeview at ./views.jl:124 [inlined]
 [7] dotview at ./broadcast.jl:1067 [inlined]
 [8] initProximalSynapses(::Tuple{UInt32,UInt32}, ::Tuple{UInt32,UInt32}, ::UInt32, ::Float32, ::Float32) at /home/oblivion/ws/numenta/custom-htm/htm.jl/src/SpatialPooler.jl:85
Oblynx commented 5 years ago

Broadcasting seems like a pretty sour issue with getindex, setindex! at the moment, and there's no light at the end of the tunnel. Better write special methods as I come across new access patterns...

Oblynx commented 5 years ago

The final solution should combine views and broadcasting. No idea how this should work for SparseMatrices unfortunately. PoC: http://ssfrr.com/2017/11/03/julia_fast_array_slicing/

Oblynx commented 5 years ago

Not relevant in current SparseSynapse implementation (branch sp-sparse)