aboutsummaryrefslogtreecommitdiffhomepage
path: root/problems/14-Matrix-Square
diff options
context:
space:
mode:
Diffstat (limited to 'problems/14-Matrix-Square')
-rw-r--r--problems/14-Matrix-Square/answer_2_float_8x8.vsm7
-rw-r--r--problems/14-Matrix-Square/testcase_2_float_8x8.rb14
2 files changed, 21 insertions, 0 deletions
diff --git a/problems/14-Matrix-Square/answer_2_float_8x8.vsm b/problems/14-Matrix-Square/answer_2_float_8x8.vsm
index e69de29..b27313b 100644
--- a/problems/14-Matrix-Square/answer_2_float_8x8.vsm
+++ b/problems/14-Matrix-Square/answer_2_float_8x8.vsm
@@ -0,0 +1,7 @@
+gmwrite $lm0v $ly0; gbfn $lm0v $lr128v
+gmwrite $lm8v $ly4; gbfn $lm8v $lr136v
+gmread $ly0 $lr0v; gmwrite $lr128v $lx0
+gbfn $mreadf $lr0v; gmread $ly4 $ls0v; gmwrite $lr136v $lx4
+gbfn $mreadf $ls0v
+gmmul $lx $lr0v $ln0v
+gmmul $lx $ls0v $ln8v
diff --git a/problems/14-Matrix-Square/testcase_2_float_8x8.rb b/problems/14-Matrix-Square/testcase_2_float_8x8.rb
new file mode 100644
index 0000000..b252979
--- /dev/null
+++ b/problems/14-Matrix-Square/testcase_2_float_8x8.rb
@@ -0,0 +1,14 @@
+require 'matrix'
+
+a = Matrix[
+ [3.0, 9.0, 7.0, 5.0, 1.0, 1.0, 0.0, 8.0],
+ [6.0, 7.0, 0.0, 9.0, 8.0, 2.0, 1.0, 1.0],
+ [3.0, 5.0, 4.0, 2.0, 6.0, 1.0, 2.0, 3.0],
+ [4.0, 7.0, 1.0, 5.0, 5.0, 0.0, 6.0, 1.0],
+ [0.0, 9.0, 9.0, 8.0, 3.0, 0.0, 6.0, 4.0],
+ [1.0, 4.0, 0.0, 9.0, 2.0, 6.0, 3.0, 5.0],
+ [5.0, 1.0, 9.0, 7.0, 9.0, 8.0, 5.0, 9.0],
+ [0.0, 1.0, 0.0, 3.0, 3.0, 2.0, 8.0, 3.0],
+]
+
+puts a**2