gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/gdt-plot.lua
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2012年12月23日 22:32:09 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2012年12月23日 22:32:09 +0100
commit07c0d50aebdc2e0c0d2daf40c47396cf8c2fa915 (patch)
treeccb5f4344924ebb9c4b95e12be384c1104b051e3 /gdt-plot.lua
parent9fc8b2eec436657cef9e69031e82714111657f89 (diff)
downloadgsl-shell-07c0d50aebdc2e0c0d2daf40c47396cf8c2fa915.tar.gz
Implement cursor for gdt tables
Diffstat (limited to 'gdt-plot.lua')
-rw-r--r--gdt-plot.lua 14
1 files changed, 3 insertions, 11 deletions
diff --git a/gdt-plot.lua b/gdt-plot.lua
index 26cf8bbf..ecb09911 100644
--- a/gdt-plot.lua
+++ b/gdt-plot.lua
@@ -390,20 +390,12 @@ end
local function gdt_table_linfit(t, f, jy)
local N, M = t:dim()
- local name = {}
- for k = 1, M do
- name[k] = t:get_header(k)
- end
- local row = {}
- for k = 1, M do
- row[name[k]] = t:get(1, k)
- end
+ local row = t:cursor()
local P = count_args(f(row))
local X, Y = matrix.alloc(N, P), matrix.alloc(N, 1)
- for i = 1, N do
- for k = 1, M do row[name[k]] = t:get(i, k) end
- set_elements(X, P, i, f(row))
+ for i, row in t:rows() do
+ set_elements(X, P, i, f(row, i))
Y:set(i, 1, t:get(i, jy))
end
generated by cgit v1.2.3 (git 2.25.1) at 2025年09月16日 22:12:58 +0000

AltStyle によって変換されたページ (->オリジナル) /