Permalink
Browse files

math.matrices: Add another test to make sure we calculate kron correc…

…tly.
  • Loading branch information...
1 parent 7f8d1cf commit 3756191a284d066a70a91d4913566035d868c6ef @erg erg committed May 24, 2012
Showing with 28 additions and 0 deletions.
  1. +28 −0 basis/math/matrices/matrices-tests.factor
@@ -239,3 +239,31 @@ IN: math.matrices.tests
{ 1 -1 -1 1 -1 1 1 -1 }
}
} [ { { 1 1 } { 1 -1 } } dup dup kron swap kron ] unit-test
+
+
+! kron is not generally commutative, make sure we have the right order
+{
+ {
+ { 1 2 3 4 5 1 2 3 4 5 }
+ { 6 7 8 9 10 6 7 8 9 10 }
+ { 1 2 3 4 5 -1 -2 -3 -4 -5 }
+ { 6 7 8 9 10 -6 -7 -8 -9 -10 }
+ }
+}
+[
+ { { 1 1 } { 1 -1 } }
+ { { 1 2 3 4 5 } { 6 7 8 9 10 } } kron
+] unit-test
+
+{
+ {
+ { 1 1 2 2 3 3 4 4 5 5 }
+ { 1 -1 2 -2 3 -3 4 -4 5 -5 }
+ { 6 6 7 7 8 8 9 9 10 10 }
+ { 6 -6 7 -7 8 -8 9 -9 10 -10 }
+ }
+}
+[
+ { { 1 1 } { 1 -1 } }
+ { { 1 2 3 4 5 } { 6 7 8 9 10 } } swap kron
+] unit-test

0 comments on commit 3756191

Please sign in to comment.