Mercurial > octave-nkf
changeset 12809:8dd680993088
codesprint: Wrote 6 tests for commutation_matrix.m
author | Sean Young <seannz@gmail.com> |
---|---|
date | Sat, 16 Jul 2011 13:47:05 -0500 |
parents | 1a3cdafcb2a5 |
children | 59199c04ad17 |
files | scripts/linear-algebra/commutation_matrix.m |
diffstat | 1 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/linear-algebra/commutation_matrix.m Sat Jul 16 11:38:16 2011 -0700 +++ b/scripts/linear-algebra/commutation_matrix.m Sat Jul 16 13:47:05 2011 -0500 @@ -95,3 +95,25 @@ endfor endfunction + +%!test +%! c = commutation_matrix(1,1); +%! assert(c,1); + +%!test +%! A = rand(3,5); +%! vc = vec(A); +%! vr = vec(A'); +%! c = commutation_matrix(3,5); +%! assert(c*vc,vr); + +%!test +%! A = rand(4,6); +%! vc = vec(A); +%! vr = vec(A'); +%! c = commutation_matrix(4,6); +%! assert(c*vc,vr); + +%!error commutation_matrix(0,0); +%!error commutation_matrix(1,0); +%!error commutation_matrix(0,1);