In gdt plot skip lines with undefined values - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2013年01月28日 14:23:36 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2013年01月28日 14:23:36 +0100
commitfe5cea0c67ac178d6476beb64f2bd5fcf4acb0f0 (patch)
tree549af8c43a20c85278cbe0125475489fbbe3a93f
parent74b7eb0bd37256e3dc9a38d3f576febcbed891ce (diff)
downloadgsl-shell-fe5cea0c67ac178d6476beb64f2bd5fcf4acb0f0.tar.gz
In gdt plot skip lines with undefined values
Diffstat
-rw-r--r--gdt-plot.lua 22
1 files changed, 17 insertions, 5 deletions
diff --git a/gdt-plot.lua b/gdt-plot.lua
index f774c901..bad60f47 100644
--- a/gdt-plot.lua
+++ b/gdt-plot.lua
@@ -55,7 +55,17 @@ local function compare_list(a, b)
return true
end
+local function has_undef_values(ls)
+ local n = #ls
+ for k = 1, n do
+ if not ls[k] then return true end
+ end
+ return false
+end
+
local function add_unique(ls, e)
+ if has_undef_values(e) then return 0 end
+
local n = #ls
for i = 1, n do
if compare_list(ls[i], e) then return i end
@@ -120,11 +130,13 @@ local function rect_funcbin(t, jxs, jys, jes)
local v = eval(jp.expr, eval_scope)
if v then
local ie = add_unique(enums, e)
- local ix = add_unique(labels, c)
- local cc = vec2d_incr(count, ix, ie)
- local v_accu = vec2d_get(val, ix, ie) or f0
- vec2d_set(val, ix, ie, fy(v_accu, v, cc))
- fini_table[ie] = fini
+ local ix = ie > 0 and add_unique(labels, c) or 0
+ if ix > 0 then
+ local cc = vec2d_incr(count, ix, ie)
+ local v_accu = vec2d_get(val, ix, ie) or f0
+ vec2d_set(val, ix, ie, fy(v_accu, v, cc))
+ fini_table[ie] = fini
+ end
end
end
end
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月15日 12:30:41 +0000

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