title: error with vectorized function in Julia: "arrays could not be broadcast to a common size"
body: <p>I get an error when trying to evaluate the following function in Julia (Version 0.3.11, 2015-07-27 06:18 UTC, LinuxMint Rebecca):</p>
  
  <pre><code># this_script.jl
  # global parameters
  c = [ 1.0 , 2.0]
  u = [-1.0 , 3.5]
  
  # A simplified version of a more complicated function
  function f(x,y)
      xi = c .* (x/y - u)
  
      1.0 + sum( erfi(xi) )
  end
  
  @vectorize_2arg Number f
  </code></pre>
  
  <p>I can evaluate things like <code>f(2,1)</code>, <code>f(2+im,1)</code>, or</p>
  
  <pre><code>x=linspace(-2,2,4);
  f(x,x)
  
  y=rand(4,4)
  f(y,y)
  </code></pre>
  
  <p><strong>However, the following lines throw an error:</strong></p>
  
  <pre><code>u=repmat(x,1,4)
  f(u,u)
  
  ERROR: arrays could not be broadcast to a common size
   in broadcast_shape at broadcast.jl:40
   in .* at broadcast.jl:278
   in f at operators.jl:377
   in include at ./boot.jl:245
   in include_from_node1 at ./loading.jl:128
  while loading this_script.jl, in expression starting on line 103
  </code></pre>
  
  <p>After that, I cannot evaluate <code>f</code> anymore even with <code>f(2,1)</code> nor <code>f(x,x)</code>. Notice that <code>u</code> and <code>y</code> have the same dimensions and type.</p>
  
  <p><strong>How can I handle this?</strong></p>