diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-06-29 22:45:21 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-06-29 22:45:21 +0200 |
| commit | 53ecaeeee3a24c016b4fd3c6a577ac22ac47775a (patch) | |
| tree | 975b4c018d446d0fa441099128211dbabefacbe6 /scripts/python | |
| parent | 78e8a621beff8ccd410f2e2c0b6df7f3931b52eb (diff) | |
| parent | b88d59477a7973bdee102aaf0e26c13c9059048b (diff) | |
| download | libs-lbm-53ecaeeee3a24c016b4fd3c6a577ac22ac47775a.tar.gz | |
Diffstat (limited to 'scripts/python')
| -rwxr-xr-x | scripts/python/csv_l2_norm.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/python/csv_l2_norm.py b/scripts/python/csv_l2_norm.py new file mode 100755 index 0000000..88f4817 --- /dev/null +++ b/scripts/python/csv_l2_norm.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +import argparse +import numpy as np + + +def main(): + parser = argparse.ArgumentParser(description="Compute the L2 Norm"); + parser.add_argument("one"); + parser.add_argument("two"); + args = parser.parse_args(); + + a = np.loadtxt(args.one, delimiter=","); + b = np.loadtxt(args.two, delimiter=","); + + if a.shape != b.shape: + raise ValueError(f"Shape mismatch: {a.shape} vs {b.shape}"); + #endif + + print(np.linalg.norm(a-b)); + +#enddef + +if __name__ == "__main__": + main(); +#enddef |
