Mercurial > hg > octave-lojdl
diff scripts/image/flag.m @ 14279:f205d0074687
Update colormap files with faster code.
* autumn.m, bone.m, cool.m, copper.m, flag.m, gmap40.m, gray.m, hot.m, hsv.m,
jet.m, lines.m, ocean.m, pink.m, prism.m, rainbow.m, spring.m, summer.m,
white.m, winter.m: Use indexing in place of kron or repmat for faster code.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sat, 28 Jan 2012 22:33:57 -0800 |
parents | 1f911333ed3d |
children | b9c02ee24de1 |
line wrap: on
line diff
--- a/scripts/image/flag.m +++ b/scripts/image/flag.m @@ -40,14 +40,8 @@ print_usage (); endif - p = [1, 0, 0; 1, 1, 1; 0, 0, 1; 0, 0, 0]; - if (rem(n,4) == 0) - map = kron (ones (n / 4, 1), p); - else - m1 = kron (ones (fix (n / 4), 1), p); - m2 = p(1:rem (n, 4), :); - map = [m1; m2]; - endif + C = [1, 0, 0; 1, 1, 1; 0, 0, 1; 0, 0, 0]; + map = C(rem (0:(n-1), 4) + 1, :); endfunction