{"action":"created","issue":{"url":"https://api.github.com/repos/nengo/nengo/issues/845","labels_url":"https://api.github.com/repos/nengo/nengo/issues/845/labels{/name}","comments_url":"https://api.github.com/repos/nengo/nengo/issues/845/comments","events_url":"https://api.github.com/repos/nengo/nengo/issues/845/events","html_url":"https://github.com/nengo/nengo/issues/845","id":107027043,"number":845,"title":"Fonction get_convolution_matrix()","user":{"login":"MenelikV","id":11135251,"avatar_url":"https://avatars.githubusercontent.com/u/11135251?v=3","gravatar_id":"","url":"https://api.github.com/users/MenelikV","html_url":"https://github.com/MenelikV","followers_url":"https://api.github.com/users/MenelikV/followers","following_url":"https://api.github.com/users/MenelikV/following{/other_user}","gists_url":"https://api.github.com/users/MenelikV/gists{/gist_id}","starred_url":"https://api.github.com/users/MenelikV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MenelikV/subscriptions","organizations_url":"https://api.github.com/users/MenelikV/orgs","repos_url":"https://api.github.com/users/MenelikV/repos","events_url":"https://api.github.com/users/MenelikV/events{/privacy}","received_events_url":"https://api.github.com/users/MenelikV/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-17T16:54:12Z","updated_at":"2015-09-17T17:21:35Z","closed_at":null,"body":"Hello, \r\n\r\nI saw a code for a more stable working memory. \r\nThe Code is the following :\r\n\r\n```python\r\n\r\nimport numpy as np\r\n\r\nimport nengo\r\nfrom nengo.networks.workingmemory import InputGatedMemory as WM\r\nfrom nengo.spa import Vocabulary\r\n\r\n#Integrator parameters \r\nn_neurons = 100\r\nd = 32\r\ndiff_gain = 15\r\n\r\nvocab = Vocabulary(d, unitary=True)\r\nvocab.parse('POS1')\r\nvocab.parse('INC')\r\n\r\nfor n in range(4):\r\n    vocab.add('POS%i' % (n + 2),\r\n              vocab.parse('POS%i * INC' % (n + 1)))\r\n\r\n#Input function\r\ninput_func = lambda t: (vocab.parse('POS1').v if t < 0.2\r\n                        else vocab.parse('0').v)\r\ngate_func = lambda t: [int((t * 10) % 2),\r\n                       1 - int((t * 10) % 2)]\r\n\r\n#Nengo model \r\nwith nengo.Network() as model:\r\n    # Generate the input to the memory\r\n    in_node = nengo.Node(input_func, label='Input Node')\r\n    gate_node = nengo.Node(gate_func, label='Gate Input')\r\n\r\n    # Working memory networks (doubled up, with different\r\n    # gate signals)\r\n    mem1 = WM(n_neurons, d, difference_gain=diff_gain)\r\n    mem2 = WM(n_neurons, d, difference_gain=diff_gain)\r\n\r\n    nengo.Connection(in_node, mem1.input)\r\n    nengo.Connection(mem1.output, mem2.input)\r\n    nengo.Connection(\r\n        mem2.output, mem1.input,\r\n        transform=vocab['INC'].get_convolution_matrix())\r\n\r\n    nengo.Connection(gate_node[0], mem1.gate)\r\n    nengo.Connection(gate_node[1], mem2.gate)\r\n\r\n    # Compute the similarity of the output vector\r\n    sim_node = \\\r\n        nengo.Node(lambda t, x: np.dot(x, vocab.vectors.T),\r\n                   size_in=d, label='similarity')\r\n    nengo.Connection(mem1.output, sim_node)\r\n```\r\nI wanted to rewrite the code to make it work without the spa framework but I did not get what precisely the ` transform=vocab['INC'].get_convolution_matrix()` is doing.\r\n\r\nSo the question is : what the method `get_convolution_matrix()` is doing ?\r\nI search for it across the github but I was not able to obtain the source of this function.\r\n\r\nThanks in advance for your answers and your time,\r\n\r\nMénélik"},"comment":{"url":"https://api.github.com/repos/nengo/nengo/issues/comments/141157712","html_url":"https://github.com/nengo/nengo/issues/845#issuecomment-141157712","issue_url":"https://api.github.com/repos/nengo/nengo/issues/845","id":141157712,"user":{"login":"MenelikV","id":11135251,"avatar_url":"https://avatars.githubusercontent.com/u/11135251?v=3","gravatar_id":"","url":"https://api.github.com/users/MenelikV","html_url":"https://github.com/MenelikV","followers_url":"https://api.github.com/users/MenelikV/followers","following_url":"https://api.github.com/users/MenelikV/following{/other_user}","gists_url":"https://api.github.com/users/MenelikV/gists{/gist_id}","starred_url":"https://api.github.com/users/MenelikV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MenelikV/subscriptions","organizations_url":"https://api.github.com/users/MenelikV/orgs","repos_url":"https://api.github.com/users/MenelikV/repos","events_url":"https://api.github.com/users/MenelikV/events{/privacy}","received_events_url":"https://api.github.com/users/MenelikV/received_events","type":"User","site_admin":false},"created_at":"2015-09-17T17:21:35Z","updated_at":"2015-09-17T17:21:35Z","body":"Thanks for your answers !\r\n@xchoo , your code seems to be what I was looking for :D\r\nJust one short question about your code, why 3.5 / sqrt(dimensions) for the radius ?"}}