diff options
| author | wukong <wukong@longaeva> | 2026-04-10 23:46:12 -0700 |
|---|---|---|
| committer | wukong <wukong@longaeva> | 2026-04-10 23:46:12 -0700 |
| commit | 4c4eb1bd8f003b3b57707badd2dd089ed193a896 (patch) | |
| tree | 15b62907fffd70c46a9b4369df93ab33c6aa88ac /lin_reg1.awk | |
| parent | e7d1781578e846a7b1d634cd43c8fab00a67b883 (diff) | |
renamed fir window generators;
minor edits to whitespace and comments for more consistent style;
Diffstat (limited to '')
| -rw-r--r-- | lin_reg1.awk | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lin_reg1.awk b/lin_reg1.awk index c657035..7786247 100644 --- a/lin_reg1.awk +++ b/lin_reg1.awk @@ -3,6 +3,7 @@ ### lin_reg1.awk # simple linear regression between columns + BEGIN { sign = "[+-]?" decimal = "[0-9]+[.]?[0-9]*" @@ -11,22 +12,26 @@ BEGIN { number = "^" sign "(" decimal "|" fraction ")" exponent "$" } + +# column headers NR == 1 { for (n=1; n<=NF; n++) ($n ~ number) ? header[n] = "col" n : header[n] = $n } + +# read input data NF > 0 { - if (NF > nf_max) - nf_max = NF + (NF > nf_max) ? nf_max = NF : nf_max = nf_max - ### iterate over columns + # columns for (y=1; y<=nf_max; y++) { if ($y == header[n]) continue + if ($y ~ number) { - ### mean + # mean count[y] += 1 sum[y] += $y sum2[y] += $y*$y @@ -62,6 +67,7 @@ NF > 0 { } } + END { for (y=1; y<=nf_max; y++) { for (x=1; x<=nf_max; x++) { |
