comparison scripts/special-matrix/gallery.m @ 20333:ababbe103048

gallery: allow N to be a 2 element vectors for cycol matrices.
author Carnë Draug <carandraug@octave.org>
date Fri, 03 Jul 2015 16:33:31 +0100
parents 26fc9bbb8762
children c5a8eff5a05d
comparison
equal deleted inserted replaced
20332:26fc9bbb8762 20333:ababbe103048
909 A(i,i) = 1; 909 A(i,i) = 1;
910 endfor 910 endfor
911 endif 911 endif
912 endfunction 912 endfunction
913 913
914 function A = cycol (n, k = max (round (n/4), 1)) 914 function A = cycol (n, k = max (round (n(end)/4), 1))
915 ## CYCOL Matrix whose columns repeat cyclically. 915 ## CYCOL Matrix whose columns repeat cyclically.
916 ## A = CYCOL([M N], K) is an M-by-N matrix of the form A = B(1:M,1:N) 916 ## A = CYCOL([M N], K) is an M-by-N matrix of the form A = B(1:M,1:N)
917 ## where B = [C C C...] and C = RANDN(M, K). Thus A's columns repeat 917 ## where B = [C C C...] and C = RANDN(M, K). Thus A's columns repeat
918 ## cyclically, and A has rank at most K. K need not divide N. 918 ## cyclically, and A has rank at most K. K need not divide N.
919 ## K defaults to ROUND(N/4). 919 ## K defaults to ROUND(N/4).