<p>There is a paper <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.3166" rel="nofollow">How to Approximate the Inner-product: Fast Dynamic Algorithms for Euclidean Similarity</a> describing how to perform a fast approximation of the inner product. If this is not good or fast enough, I suggest to build an index containing all your documents. A structure similar to a <a href="http://en.wikipedia.org/wiki/Quadtree" rel="nofollow">quadtree</a> but based on a <a href="http://en.wikipedia.org/wiki/Geodesic_grid" rel="nofollow">geodesic grid</a> would probably work really well, see <a href="http://arxiv.org/abs/cs/0701164" rel="nofollow">Indexing the Sphere with the Hierarchical Triangular Mesh</a>.</p>

<p>UPDATE: I completely forgot that you are dealing with 100 dimensions. Indexing high dimensional data is <a href="http://en.wikipedia.org/wiki/Curse_of_dimensionality" rel="nofollow">notoriously hard</a> and I am not sure how well indexing a sphere will generalize to 100 dimensions.</p>
How to optimize finding similarities?
<p>I have a set of 30 000 documents represented by vectors of floats. All vectors have 100 elements. I can find similarity of two documents by comparing them using cosine measure between their vectors. The problem is that it takes to much time to find the most similar documents. Is there any algorithm which can help me with speeding up this?</p>

<p><strong>EDIT</strong></p>

<p>Now, my code just counts cosine similarity between first and all others vectors. It takes about 3 sec. I would like to speed it up ;) algorithm doesn't have to be accurate but should give similar results to full search.</p>

<p>Sum of elements of each vector is equal 1.</p>

<pre><code>start = time.time()

first = allVectors[0]
for vec in allVectors[1:]:
    cosine_measure(vec[1:], first[1:])

print str(time.time() - start)
</code></pre>