aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--problems/14-Matrix-Square/answer_2_float_8x8.vsm7
-rw-r--r--problems/14-Matrix-Square/testcase_2_float_8x8.rb14
3 files changed, 22 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 6b09541..e8a812c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-all: matrix_square_testcase_1
+all: matrix_square_testcase_2
matrix_square_testcase_1:
./judge problems/14-Matrix-Square/testcase_1_double_4x4.vsm problems/14-Matrix-Square/answer_1_double_4x4.vsm
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