summaryrefslogtreecommitdiff
path: root/ludcmp.awk
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ludcmp.awk8
1 files changed, 6 insertions, 2 deletions
diff --git a/ludcmp.awk b/ludcmp.awk
index 6c7807a..8097263 100644
--- a/ludcmp.awk
+++ b/ludcmp.awk
@@ -11,6 +11,7 @@
# note, matrix indexing begins with 1 and uses i=row, j=col
# lu = L + U - I
+
# decomposition of A
function lu_decomp(A, n) {
@@ -43,6 +44,7 @@ function lu_decomp(A, n) {
}
}
+
# regex to identify strings that look like numbers
BEGIN {
OFS = FS
@@ -53,12 +55,14 @@ BEGIN {
number = "^" sign "(" decimal "|" fraction ")" exponent "$"
}
+
# column headers
NR == 1 {
for (n=1; n<=NF; n++)
($n ~ number) ? head[n] = "col" n : head[n] = $n
}
+
# read input data
NF {
@@ -74,17 +78,17 @@ NF {
print(matrix[count[n],n])
}
}
-
}
+
END {
printf(ORS)
print(NR, max_nf, size)
printf(ORS)
lu_decomp(matrix, size)
-
}
+
## find solution of Ly = b, for y
#for (i=0; i<n;, i++) {
# sum = 0