commit | 30a4321b2f94d032c21de8e134ec42ab8aebcb7d | [log] [tgz] |
---|---|---|
author | Marc Kupietz <kupietz@ids-mannheim.de> | Thu Feb 25 08:12:00 2016 +0100 |
committer | Marc Kupietz <kupietz@ids-mannheim.de> | Thu Feb 25 08:12:00 2016 +0100 |
tree | f175d475d7e56c8f7c2a12c9b8045b71fc4d6ab8 | |
parent | c4893362c0963dccd1ce8d0d9fb5b3d0e38b37dd [diff] |
w2v-server.pl: speed up vector-loading
diff --git a/w2v-server.pl b/w2v-server.pl index f51f9da..c2d96bb 100644 --- a/w2v-server.pl +++ b/w2v-server.pl
@@ -76,7 +76,7 @@ if ((a < max_w) && (vocab[b * max_w + a] != '\n')) a++; } vocab[b * max_w + a] = 0; - for (a = 0; a < size; a++) fread(&M[a + b * size], sizeof(float), 1, f); + fread(&M[b * size], sizeof(float), size, f); len = 0; for (a = 0; a < size; a++) len += M[a + b * size] * M[a + b * size]; len = sqrt(len);