Module matrix

Implements a fraction of matrix operations (methods) in Lua, while others are implemented in C extension.

Info:

  • Author: Ted Yin

Class nerv.Matrix

nerv.Matrix:__tostring__ () Convert the matrix object to a string.
nerv.Matrix:generate (gen) Assign each element in a matrix using the value returned by a callback gen.
nerv.Matrix:create (nrow, ncol) Create a fresh new matrix of the same matrix type (as self).
nerv.Matrix:__add__ (b) Operator overloading of +.
nerv.Matrix:__sub__ (b) Operator overloading of -.
nerv.Matrix:__mul__ (b) Operator overloading of *.

Class nerv.CuMatrixFloat

nerv.CuMatrixFloat.new_from_host (mat) Create a CUDA matrix copy of the host matrix (in memory)
nerv.CuMatrixFloat:new_to_host () Create a host matrix copy of the CUDA matrix

Class nerv.CuMatrixDouble

nerv.CuMatrixDouble.new_from_host (mat) Create a CUDA matrix copy of the host matrix (in memory)
nerv.CuMatrixDouble:new_to_host () Create a host matrix copy of the CUDA matrix

Class nerv.MMatrix

nerv.MMatrix:copy_toh (b, ...) A wrapper function for copy_fromh
nerv.MMatrix.print_profile () Print profiling info of host matrices
nerv.MMatrix.clear_profile () Clear profiling info of host matrices


Class nerv.Matrix

The base class for all matrices.
nerv.Matrix:__tostring__ ()
Convert the matrix object to a string.
nerv.Matrix:generate (gen)
Assign each element in a matrix using the value returned by a callback gen.

Parameters:

  • gen the callback used to generated the values in the matrix, to which the indices of row and column will be passed (e.g., gen(i, j))
nerv.Matrix:create (nrow, ncol)
Create a fresh new matrix of the same matrix type (as self).

Parameters:

  • nrow optional, the number of rows in the created matrix if specified, otherwise self:nrow() will be used
  • ncol optional, the number of columns in the created matrix if specified, otherwise self:ncol() will be used
nerv.Matrix:__add__ (b)
Operator overloading of +.

Parameters:

  • b
nerv.Matrix:__sub__ (b)
Operator overloading of -.

Parameters:

  • b
nerv.Matrix:__mul__ (b)
Operator overloading of *.

Parameters:

  • b

Class nerv.CuMatrixFloat

CUDA float matrices
nerv.CuMatrixFloat.new_from_host (mat)
Create a CUDA matrix copy of the host matrix (in memory)

Parameters:

  • mat the host matrix
nerv.CuMatrixFloat:new_to_host ()
Create a host matrix copy of the CUDA matrix

Class nerv.CuMatrixDouble

CUDA double matrices
nerv.CuMatrixDouble.new_from_host (mat)
Create a CUDA matrix copy of the host matrix (in memory)

Parameters:

  • mat the host matrix
nerv.CuMatrixDouble:new_to_host ()
Create a host matrix copy of the CUDA matrix

Class nerv.MMatrix

The base class for all host (in-memory) matrices
nerv.MMatrix:copy_toh (b, ...)
A wrapper function for copy_fromh

Parameters:

  • b
  • ...
nerv.MMatrix.print_profile ()
Print profiling info of host matrices
nerv.MMatrix.clear_profile ()
Clear profiling info of host matrices
generated by LDoc 1.4.3 Last updated 2016-01-15 14:56:30