title: How to obtain complexity cosine similarity in Matlab?
body: <p>I have implemented cosine similarity in Matlab like this. In fact, I have a two-dimensional 50-by-50 matrix. To obtain a cosine should I compare items in a line by line form.</p>
  
  <pre><code>for j = 1:50
      x = dat(j,:);
      for i = j+1:50
          y = dat(i,:);
          c = dot(x,y);
          sim = c/(norm(x,2)*norm(y,2));
      end
  end
  </code></pre>
  
  <p>Is this correct?
  and The question is this: wath is the complexity or O(n) in this state? </p>