diff --git a/DataLoader/Eigen.cs b/DataLoader/Eigen.cs
index 3a597f7..3c55e9f 100644
--- a/DataLoader/Eigen.cs
+++ b/DataLoader/Eigen.cs
@@ -7,8 +7,10 @@ public partial class DataLoader
{
const string dll = @"VectorSearch.dll";
[DllImport(dll, CallingConvention = CallingConvention.Cdecl)]
- private static extern IntPtr findTopCandidates(IntPtr cV, IntPtr cI, IntPtr sV, IntPtr sI,
- int cVL, int cIL, int sVL, int sIL,
+ private static extern IntPtr findTopCandidates(IntPtr cV, IntPtr cI,
+ IntPtr sV, IntPtr sI,
+ int cVL, int cIL,
+ int sVL, int sIL,
int n, float tolerance);
[DllImport(dll, CallingConvention = CallingConvention.Cdecl)]
@@ -87,9 +89,11 @@ public static int Eigen(int nrCandidates, int nrSpectra, int topN, Random r)
IntPtr sValuesPtr = sValuesLoc.AddrOfPinnedObject();
IntPtr sIdxPtr = sIdxLoc.AddrOfPinnedObject();
- IntPtr result = findTopCandidates(cValuesPtr, cIdxPtr, sValuesPtr, sIdxPtr,
- candidateValues.Length, candidatesIdx.Length, spectraValues.Length, spectraIdx.Length,
- topN, (float)0.02);
+ IntPtr result = findTopCandidates(cValuesPtr, cIdxPtr,
+ sValuesPtr, sIdxPtr,
+ candidateValues.Length, candidatesIdx.Length,
+ spectraValues.Length, spectraIdx.Length,
+ topN, (float) 0.02);
Marshal.Copy(result, resultArray, 0, spectraIdx.Length * topN);
diff --git a/VectorSearch/VectorSearch.vcxproj b/VectorSearch/VectorSearch.vcxproj
index 1a51d29..c2abbb3 100644
--- a/VectorSearch/VectorSearch.vcxproj
+++ b/VectorSearch/VectorSearch.vcxproj
@@ -31,7 +31,7 @@
true
v143
Unicode
- true
+ false
DynamicLibrary
@@ -39,14 +39,14 @@
v143
true
Unicode
- true
+ false
DynamicLibrary
true
v143
Unicode
- true
+ false
DynamicLibrary
@@ -54,7 +54,7 @@
v143
true
Unicode
- true
+ false
diff --git a/VectorSearch/dllmain.cpp b/VectorSearch/dllmain.cpp
index 407363b..80efe2f 100644
--- a/VectorSearch/dllmain.cpp
+++ b/VectorSearch/dllmain.cpp
@@ -6,7 +6,7 @@
#include
const int versionMajor = 1;
-const int versionMinor = 1;
+const int versionMinor = 2;
const int versionFix = 0;
#define METHOD_EXPORTS
@@ -23,8 +23,10 @@ const int APPROX_NNZ_PER_ROW = 100;
const double ONE_OVER_SQRT_PI = 0.39894228040143267793994605993438;
extern "C" {
- EXPORT int* findTopCandidates(int*, int*, int*, int*,
- int, int, int, int,
+ EXPORT int* findTopCandidates(int*, int*,
+ int*, int*,
+ int, int,
+ int, int,
int, float);
EXPORT int releaseMemory(int*);
@@ -47,8 +49,10 @@ float normpdf(float, float, float);
/// How many of the best hits should be returned (int).
/// Tolerance for peak matching (float).
/// An integer array of length sILength * n containing the indexes of the top n candidates for each spectrum.
-int* findTopCandidates(int* candidatesValues, int* candidatesIdx, int* spectraValues, int* spectraIdx,
- int cVLength, int cILength, int sVLength, int sILength,
+int* findTopCandidates(int* candidatesValues, int* candidatesIdx,
+ int* spectraValues, int* spectraIdx,
+ int cVLength, int cILength,
+ int sVLength, int sILength,
int n, float tolerance) {
std::cout << "Running Eigen vector search version " << versionMajor << "." << versionMinor << "." << versionFix << std::endl;
@@ -79,6 +83,7 @@ int* findTopCandidates(int* candidatesValues, int* candidatesIdx, int* spectraVa
int startIter = spectraIdx[i];
int endIter = i + 1 == sILength ? sVLength : spectraIdx[i + 1];
auto* v = new Eigen::SparseVector(ENCODING_SIZE);
+ v->reserve(APPROX_NNZ_PER_ROW);
for (int j = startIter; j < endIter; ++j) {
auto currentPeak = spectraValues[j];
auto minPeak = currentPeak - t > 0 ? currentPeak - t : 0;
diff --git a/VectorSearchCUDA/dllmain.cpp b/VectorSearchCUDA/dllmain.cpp
index 47cc04b..85dce59 100644
--- a/VectorSearchCUDA/dllmain.cpp
+++ b/VectorSearchCUDA/dllmain.cpp
@@ -239,7 +239,6 @@ float normpdf(float x, float mu, float sigma) {
return (ONE_OVER_SQRT_PI / sigma) * exp(-0.5 * squared((x - mu) / sigma));
}
-
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
diff --git a/dll/VectorSearch.dll b/dll/VectorSearch.dll
index cc7e486..3dc908b 100644
Binary files a/dll/VectorSearch.dll and b/dll/VectorSearch.dll differ
diff --git a/dll/VectorSearchCUDA.dll b/dll/VectorSearchCUDA.dll
index 153821c..391afec 100644
Binary files a/dll/VectorSearchCUDA.dll and b/dll/VectorSearchCUDA.dll differ