neurotools.obsolete.gpu.cpu.util module

Helper functions

neurotools.obsolete.gpu.cpu.util.document(name, docstring)[source]

This function adds in documentation to anonymous (lambda) functions. Sphinx autodoc will also accept the first triple-quote string folloing a lambda function declataion as the docstring

neurotools.obsolete.gpu.cpu.util.flat(arr)[source]

A naive flatten functions : concatenates a list of lists via lots of copying

neurotools.obsolete.gpu.cpu.util.compose(f)

Curried function composition operator. Use as compose(f)(g) to make a composed function.

neurotools.obsolete.gpu.cpu.util.dot(a, b)

dot = lambda a,b:sum(lmul(a,b)) Computes the dot product of two vectors

neurotools.obsolete.gpu.cpu.util.length(V)

Computes the magnitude of an array, interpreted as an N-vector

neurotools.obsolete.gpu.cpu.util.idivup(a, b)

Divides a by b, rounding up to the nearest integer. Eqivalent to ceil(a/b)

neurotools.obsolete.gpu.cpu.util.fancy(s)

This will wap a string into the math markup code for pyplot

neurotools.obsolete.gpu.cpu.util.elem(f)

Curried function for creating elementwise binary list operators. For example, elem(lambda x,y:x+y)(listA)(listB) will create a third list containing elementwise sum of listA and listB. Equivalently, cmap(lambda x,y:x+y)(zip(listA,listB))

neurotools.obsolete.gpu.cpu.util.cmap(f)

This is a curried verion of the map operator. cmap(f) will create a map version of f. For example, cmap(lambda x:x+1) creates a map of the succesor function. cmap(lambda x:x+1)(list) would return a new list with 1 added to every element of the argument list

neurotools.obsolete.gpu.cpu.util.mmap(x)

mmap = lambda f:cmap(cmap(f)) This is a curried version of map that operates elementwise over lists of lists

neurotools.obsolete.gpu.cpu.util.ldif(a, b)

Element-wise difference of two lists

neurotools.obsolete.gpu.cpu.util.lsum(a, b)

Element-wise sum of two lists

neurotools.obsolete.gpu.cpu.util.lmul(a, b)

Element-wise product of two lists

neurotools.obsolete.gpu.cpu.util.ldiv(a, b)

Element-wise ratio of two lists

neurotools.obsolete.gpu.cpu.util.lpow(a, b)

Element-wise exponentiation of two lists

neurotools.obsolete.gpu.cpu.util.ldif2(a)

Element-wise difference from a list of pairs

neurotools.obsolete.gpu.cpu.util.lsum2(a)

Element-wise sum from a list of pairs

neurotools.obsolete.gpu.cpu.util.lmul2(a)

Element-wise product from a list of pairs

neurotools.obsolete.gpu.cpu.util.ldiv2(a)

Element-wise ratio from a list of pairs

neurotools.obsolete.gpu.cpu.util.lpow2(a)

Element-wise exponentiation from a list of pairs

neurotools.obsolete.gpu.cpu.util.scale(x)

Curried scalar multiplication operator. E.g. scale(2) produces a function that will double each element in a list passed to it

neurotools.obsolete.gpu.cpu.util.shift(x)

Curried scalar shift operator. E.g. shift(2) produces a function that will add 2 to each element in a list passed to it

neurotools.obsolete.gpu.cpu.util.mu(v)
neurotools.obsolete.gpu.cpu.util.var(v)

Population variance of a list

neurotools.obsolete.gpu.cpu.util.svar(v)

Sample variance of a list

neurotools.obsolete.gpu.cpu.util.sigma(v)
neurotools.obsolete.gpu.cpu.util.mean(v)

Population average of a list

neurotools.obsolete.gpu.cpu.util.std(v)

Population standard deviation of a list

neurotools.obsolete.gpu.cpu.util.sstd(v)

Sample standard deviation of a list

neurotools.obsolete.gpu.cpu.util.sem(v)

Standard error of mean for a list

neurotools.obsolete.gpu.cpu.util.norm(L)

Interprets a list as a vector and normalizes its magnitude to 1

neurotools.obsolete.gpu.cpu.util.cov(a, b)

Covariance of two lists

neurotools.obsolete.gpu.cpu.util.corr(a, b)

Pearson’s correlation coefficient of two lists

neurotools.obsolete.gpu.cpu.util.mdif(a, b)

Elementwise difference for a matrix (list of lists)

neurotools.obsolete.gpu.cpu.util.msum(a, b)

Elementwise sum for a matrix (list of lists)

neurotools.obsolete.gpu.cpu.util.mmul(a, b)

Elementwise product for a matrix (list of lists)

neurotools.obsolete.gpu.cpu.util.mdiv(a, b)

Elementwise ratio for a matrix (list of lists)

neurotools.obsolete.gpu.cpu.util.mpow(a, b)

Elementwise exponentiation for a matrix (list of lists)

neurotools.obsolete.gpu.cpu.util.mmean(a, b)

Returns the population average of each row of a matrix

neurotools.obsolete.gpu.cpu.util.mstd(a, b)

Returns the population standard deviation of each row of a matrix

neurotools.obsolete.gpu.cpu.util.mvar(a, b)

Returns the population variance deviation of each row of a matrix

neurotools.obsolete.gpu.cpu.util.rnorm(a)

Normalizes each row of a matrix independently

neurotools.obsolete.gpu.cpu.util.cut(mat, rowlen)

Cuts any subscriptable object into a list of ranges of that object. This can facilitate creation of a matrix like object form a row major packed list. For instance, if you had a 100x100 GPUArray and wanted to represent it as a list of its rows, cut(array,100) would return a list of 100 size 100 slices of your original object. Cut uses range subscripting and the returned object will most likely point to the same underlying section of memory as the argument array