mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
adjusted scale factors for DNN vectors
This commit is contained in:
parent
799ff4846e
commit
852f61ef61
@ -47,7 +47,7 @@ public class DNN_euclidean_v implements LongFunction<float[]> {
|
||||
}
|
||||
float[] vector = new float[D];
|
||||
for (int idx = 0; idx < vector.length; idx++) {
|
||||
vector[idx]= (float)((idx+value)*scale);
|
||||
vector[idx]= (float)(value+(idx*scale));
|
||||
}
|
||||
return vector;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class DNN_euclidean_v_wrap implements LongFunction<float[]> {
|
||||
value = value % N;
|
||||
float[] vector = new float[D];
|
||||
for (int idx = 0; idx < vector.length; idx++) {
|
||||
vector[idx]= (float)((idx+value)*scale);
|
||||
vector[idx]= (float)(value+(idx*scale));
|
||||
}
|
||||
return vector;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class DNNEuclideanVTest {
|
||||
@Test
|
||||
public void testBasicVectorsScaled() {
|
||||
DNN_euclidean_v vf = new DNN_euclidean_v(5, 7, 3.0);
|
||||
assertThat(vf.apply(3L)).isEqualTo(new float[]{9f,12f,15f,18f,21f});
|
||||
assertThat(vf.apply(3L)).isEqualTo(new float[]{3f,6f,9f,12f,15f});
|
||||
assertThrows(RuntimeException.class, () -> vf.apply(7));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user