function ret = fizzbuzz(matrix)
  % boolean matrix for elements divisible by 3
  fizz = rem(matrix , 3) == 0;
  % boolean matrix for elements divisible by 5
  buzz = rem(matrix , 5) == 0;
  % boolean matrix for elements divisible by 3 and 5. Multiply == and
  fb = fizz .* buzz;
  % find returns the indices (into vec(arg)), and we count
  ret = [ length(find(fizz)), length(find(buzz)), length(find(fb))];
end

%!assert(fizzbuzz(27),[1,0,0]);
%!assert(fizzbuzz(25),[0,1,0]);
%!assert(fizzbuzz(60),[1,1,1]);
%!assert(fizzbuzz([1,7,11]),[0,0,0]);
%!assert(fizzbuzz([1,3,7; 5,11,30]),[2,2,1]);
%!assert(fizzbuzz([1,2,3; 4,5,6; 7,8,9]),[3,1,0])
%!assert(fizzbuzz(ones(10,10,10)*45),[1000,1000,1000])
