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

db4
Doug Coleman 2012-05-24 09:02:47 -07:00
parent 78f1ca9f14
commit aad94d711b
1 changed files with 28 additions and 0 deletions

View File

@ -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