import numpy as np
from scipy.sparse import csc_matrix

class network(object):
    def __init__(self, nnum=1000, trainable=False):
            
        self.w = csc_matrix((nnum,nnum),dtype=np.float32) 
        self.b = np.zeros(nnum,dtype=np.float32)
	self.m = np.zeros(nnum,dtype=np.float32)
        self.v = np.zeros(nnum,dtype=np.float32)

	self.f = 0.5
    
    def step(self):
        res = self.w.dot(self.v) + self.b + self.m
	self.v = res * (res > 0)

	self.m = self.m * self.f * (self.v==0)
	print self.m.sum()
    

    
def getdata():
    num = np.random.randint(low=0,high=255,size=(200,1),dtype=np.uint8)
    x =  np.unpackbits(num,axis=1)
    y = num >125
    
    data = (x,y)
    return data    

    
    
if __name__=='__main__':
    n = network()
    for x in range(100):
        n.step()



@@ -249,50 +249,8 @@
 32)%0A
-%09self.m = np.zeros(nnum,dtype=np.float32)%0A
     
@@ -297,23 +297,8 @@
 t32)
-%0A%0A%09self.f = 0.5
 %0A   
@@ -365,16 +365,8 @@
 f.b 
-+ self.m
 %0A%09se
@@ -393,48 +393,8 @@
 0)%0A%0A
-%09self.m = self.m * self.f * (self.v==0)%0A
 %09pri
@@ -401,17 +401,17 @@
 nt self.
-m
+v
 .sum()%0A 

remove spike structure