diff options
Diffstat (limited to 'nerv/matrix/init.lua')
-rw-r--r-- | nerv/matrix/init.lua | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/nerv/matrix/init.lua b/nerv/matrix/init.lua index 722c780..5d0544a 100644 --- a/nerv/matrix/init.lua +++ b/nerv/matrix/init.lua @@ -37,10 +37,6 @@ function nerv.Matrix:__tostring__() return table.concat(strt) end ---- Assign each element in a matrix using the value returned by a callback `gen`. --- @param 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)`) - function nerv.Matrix:_generate(gen) if (self:dim() == 2) then for i = 0, self:nrow() - 1 do @@ -51,11 +47,14 @@ function nerv.Matrix:_generate(gen) end else for j = 0, self:ncol() - 1 do - self[j] = gen(j) + self[j] = gen(j) end end end +--- Assign each element in a matrix using the value returned by a callback `gen`. +-- @param 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)`) function nerv.Matrix:generate(gen) local tmp if nerv.is_type(self, 'nerv.CuMatrixFloat') then |