neurotools.obsolete.gpu.cl.matrix module

Matrix routines

This class collects routines that operate on lists of lists. Typically, arguments are in the form of a row-major ordered matrix, as well as the number of rows and number of elements in each row. These algorithms tend to parallelise over rows, but not within rows. Typical algorithms will have complexity proportional to the complexity of the corresponsing serial algorithm operating on a single row.

In interest of fixing convention, GPU matricies shall be accepted as a tuple of (data,cols). The number of rows is inferred from the length of the data.

TODO : check correlation matrix funcions, something is off here

neurotools.obsolete.gpu.cl.matrix.gputranspose(rows, cols)

Prepares a map kernel that transposed a row-major packed float matrix/ Eg gputranspose(rows,cols)(data) will transpose data. Creates a new, memoized, kernel for each array dimension

neurotools.obsolete.gpu.cl.matrix.transpose(m)

This is a list datatype wrapper to gputranspose. It accepts a matrix as a list of lists, and returns the same form

class neurotools.obsolete.gpu.cl.matrix.GPUMatrix(data, rows, cols)[source]

Bases: object

This is a shallow wrapper of GPUArray. A GPUMatrix is simply a GPUArray containing the matrix in row major order, as well as the dimensions of the matrix. GPUArray might even already have this functionality

neurotools.obsolete.gpu.cl.matrix.matkern(source)[source]

This is a higher order function to simplify row-parallelized matrix kernel creation. We assume that we have a kernel that accepts data, cols. We create a function that accepts data,cols, as either two arguments or a single tuple. We execute the kernel, assuming that the return data is placed in the argument array. We return a tuple of the now modified data and the row length

neurotools.obsolete.gpu.cl.matrix.matscalar(source)[source]

For creation of matrix kernels that compute scalar results. Accepts source. Returns a function from (data,cols)->(scalars).

neurotools.obsolete.gpu.cl.matrix.matouter(source)[source]
neurotools.obsolete.gpu.cl.matrix.convertToZScores(data, cols=None)

Equivalent to mean centering then normalization. This function does not return a value, but replaces the contents of the given data.

neurotools.obsolete.gpu.cl.matrix.meanCenter(data, cols=None)

This will subtract the mean from each row. This function modifies its arguments, replacing them with return values

neurotools.obsolete.gpu.cl.matrix.normalize(data, cols=None)

This will normalize each row of a matrix on parallel on the GPU

neurotools.obsolete.gpu.cl.matrix.magnitudes(data, cols=None)

This will return the magnitude of each row

neurotools.obsolete.gpu.cl.matrix.sums(data, cols=None)

This will return the sum of each row

neurotools.obsolete.gpu.cl.matrix.means(data, cols=None)

This will return the population mean for each row

neurotools.obsolete.gpu.cl.matrix.variances(data, cols=None)

This will return the population variance for each row

neurotools.obsolete.gpu.cl.matrix.samplevariances(data, cols=None)

This will return the sample variance for each row

neurotools.obsolete.gpu.cl.matrix.stds(x)

This will return the population standard deviation for each row

neurotools.obsolete.gpu.cl.matrix.sstds(x)

This will return the sample standard deviation for each row

neurotools.obsolete.gpu.cl.matrix.dotproducts(data, cols=None)

Also known as : a matrix times its transpose. Input data is not altered

neurotools.obsolete.gpu.cl.matrix.correlation(x)

Computes mean centered correlation matrix from a list of vectors

neurotools.obsolete.gpu.cl.matrix.correlation2(x)

Computes the uncentered correlation matrix from a list of vectors