Implement general linear regressions using gdt tables - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/gdt.lua
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2012年12月31日 16:55:42 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2013年01月05日 23:49:53 +0100
commita573b3d4c3fc1f1cb81b0aafdfc3f3cf58b794cc (patch)
tree0ea906159b7edcfe9ceb51fb2a8ad95d6da8365c /gdt.lua
parent17b2cfc6223c61693ddfcce8880ff0e89616e432 (diff)
downloadgsl-shell-a573b3d4c3fc1f1cb81b0aafdfc3f3cf58b794cc.tar.gz
Implement general linear regressions using gdt tables
Diffstat (limited to 'gdt.lua')
-rw-r--r--gdt.lua 11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdt.lua b/gdt.lua
index a53198fd..d6c769b8 100644
--- a/gdt.lua
+++ b/gdt.lua
@@ -11,6 +11,10 @@ local gdt_table_cursor = ffi.typeof("gdt_table_cursor")
local TAG_STRING = tonumber(cgdt.TAG_STRING)
local TAG_NUMBER = tonumber(cgdt.TAG_NUMBER)
+local function element_is_number(e)
+ return (e.word.hi <= TAG_NUMBER)
+end
+
local function gdt_element(t, e)
local val
if e.word.hi <= TAG_NUMBER then
@@ -30,6 +34,11 @@ local function gdt_table_get(t, i, j)
return gdt_element(t, e)
end
+local function gdt_table_get_number_unsafe(t, i, j)
+ local e = cgdt.gdt_table_get(t, i - 1, j - 1)
+ if e.word.hi <= TAG_NUMBER then return e.number end
+end
+
local function gdt_table_set(t, i, j, val)
assert(i > 0 and i <= t.size1, 'invalid row index')
assert(j > 0 and j <= t.size2, 'invalid column index')
@@ -280,6 +289,8 @@ gdt = {
get = gdt_table_get,
set = gdt_table_set,
filter = gdt_table_filter,
+
+ get_number_unsafe = gdt_table_get_number_unsafe,
}
return gdt
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月27日 06:27:34 +0000

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