aboutsummaryrefslogtreecommitdiff
path: root/matrix.lua
blob: 2a705900f55b6fc0d310a2ec35f3c74d490f6e1a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function nerv.FloatMatrix:__tostring__()
    local ncol = self:ncol()
    local nrow = self:nrow()
    local i = 0
    local res = ""
    for row = 0, nrow - 1 do
        for col = 0, ncol - 1 do
            res = res .. string.format("%f ", self:get_elem(i))
            i = i + 1
        end
        res = res .. "\n"
    end
    res = res .. string.format("[Float Matrix %d x %d]", nrow, ncol)
    return res
end