本文整理汇总了Java中ch.ethz.globis.phtree.PhTreeSolidF.PhKnnQuerySF类的典型用法代码示例。如果您正苦于以下问题:Java PhKnnQuerySF类的具体用法?Java PhKnnQuerySF怎么用?Java PhKnnQuerySF使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PhKnnQuerySF类属于ch.ethz.globis.phtree.PhTreeSolidF包,在下文中一共展示了PhKnnQuerySF类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testQueryND64Random1
import ch.ethz.globis.phtree.PhTreeSolidF.PhKnnQuerySF; //导入依赖的package包/类
@Test
public void testQueryND64Random1() {
final int DIM = 3;
final int LOOP = 10;
final int N = 1000;
final int NQ = 100;
final int MAXV = 1000;
for (int d = 0; d < LOOP; d++) {
final Random R = new Random(d);
PhTreeSolidF<Object> ind = newTreeSF(DIM);
PhKnnQuerySF<Object> q = ind.nearestNeighbour(1, newDistFn(ind), new double[DIM]);
populate(ind, R, N, DIM, MAXV);
for (int i = 0; i < NQ; i++) {
double[] v = new double[DIM];
for (int j = 0; j < DIM; j++) {
v[j] = R.nextDouble()*MAXV;
}
PhEntrySF<Object> exp = nearestNeighbor1(ind, v);
List<PhEntrySF<Object>> nnList = toList(q.reset(1, null, v));
assertTrue("i=" + i + " d=" + d, !nnList.isEmpty());
PhEntrySF<Object> nn = nnList.get(0);
check(v, exp, nn);
}
}
}
示例2: testQueryND64Random10
import ch.ethz.globis.phtree.PhTreeSolidF.PhKnnQuerySF; //导入依赖的package包/类
@Test
public void testQueryND64Random10() {
//final int DIM = 4;//5
//final int LOOP = 1;//10;
final int N = 1000;
final int NQ = 100;
final int MAXV = 1;
for (int d = 2; d < 10; d++) {
int DIM = d;
final Random R = new Random(d);
PhTreeSolidF<Object> ind = newTreeSF(DIM);
PhKnnQuerySF<Object> q = ind.nearestNeighbour(10, newDistFn(ind), new double[DIM]);
populate(ind, R, N, DIM, MAXV);
for (int i = 0; i < NQ; i++) {
double[] v = new double[DIM];
for (int j = 0; j < DIM; j++) {
v[j] = R.nextDouble()*MAXV;
}
ArrayList<PhEntrySF<Object>> exp = nearestNeighborK(ind, 10, v);
List<PhEntrySF<Object>> nnList = toList(q.reset(10, null, v));
assertTrue("i=" + i + " d=" + d, !nnList.isEmpty());
check(v, exp, nnList);
}
}
}
示例3: testQueryND64RandomDistFunc
import ch.ethz.globis.phtree.PhTreeSolidF.PhKnnQuerySF; //导入依赖的package包/类
@Test
public void testQueryND64RandomDistFunc() {
final int DIM = 15;
final int LOOP = 10;
final int N = 1000;
final int NQ = 100;
final int MAXV = 1000;
final Random R = new Random(0);
for (int d = 0; d < LOOP; d++) {
PhTreeSolidF<Object> ind = newTreeSF(DIM);
PhKnnQuerySF<Object> q = ind.nearestNeighbour(1, newDistFn(ind), new double[DIM]);
populate(ind, R, N, DIM, MAXV);
for (int i = 0; i < NQ; i++) {
double[] v = new double[DIM];
for (int j = 0; j < DIM; j++) {
v[j] = R.nextDouble()*MAXV;
}
PhEntrySF<Object> exp = nearestNeighbor1(ind, v);
// System.out.println("d="+ d + " i=" + i + " minD=" + dist(v, exp));
// System.out.println("v="+ Arrays.toString(v));
// System.out.println("exp="+ Arrays.toString(exp));
List<PhEntrySF<Object>> nnList = toList(q.reset(1, PhDistanceF.THIS, v));
// System.out.println(ind.toStringPlain());
// System.out.println("v =" + Arrays.toString(v));
// System.out.println("exp=" + Arrays.toString(exp));
assertTrue("i=" + i + " d=" + d, !nnList.isEmpty());
PhEntrySF<Object> nn = nnList.get(0);
check(v, exp, nn);
}
}
}
示例4: testQueryND64RandomCenterAway
import ch.ethz.globis.phtree.PhTreeSolidF.PhKnnQuerySF; //导入依赖的package包/类
@Test
public void testQueryND64RandomCenterAway() {
final int DIM = 5;
final int LOOP = 10;
final int N = 1000;
final int NQ = 100;
final int MAXV = 1000;
final Random R = new Random(0);
for (int d = 0; d < LOOP; d++) {
PhTreeSolidF<Object> ind = newTreeSF(DIM);
PhKnnQuerySF<Object> q = ind.nearestNeighbour(1, newDistFn(ind), new double[DIM]);
populate(ind, R, N, DIM, 1);
for (int i = 0; i < NQ; i++) {
double[] v = new double[DIM];
for (int j = 0; j < DIM; j++) {
v[j] = R.nextDouble()*MAXV;
}
PhEntrySF<?> exp = nearestNeighbor1(ind, v);
// System.out.println("d="+ d + " i=" + i + " minD=" + dist(v, exp));
// System.out.println("v="+ Arrays.toString(v));
// System.out.println("exp="+ Arrays.toString(exp));
List<PhEntrySF<Object>> nnList = toList(q.reset(1, PhDistanceF.THIS, v));
// System.out.println(ind.toStringPlain());
// System.out.println("v =" + Arrays.toString(v));
// System.out.println("exp=" + Arrays.toString(exp));
assertTrue("i=" + i + " d=" + d, !nnList.isEmpty());
PhEntrySF<Object> nn = nnList.get(0);
check(v, exp, nn);
}
}
}
示例5: testQueryND64Random10DistFunc
import ch.ethz.globis.phtree.PhTreeSolidF.PhKnnQuerySF; //导入依赖的package包/类
@Test
public void testQueryND64Random10DistFunc() {
final int DIM = 15;
final int LOOP = 10;
final int N = 1000;
final int NQ = 100;
final int MAXV = 1;
final Random R = new Random(0);
for (int d = 0; d < LOOP; d++) {
PhTreeSolidF<Object> ind = newTreeSF(DIM);
PhKnnQuerySF<Object> q = ind.nearestNeighbour(10, newDistFn(ind), new double[DIM]);
populate(ind, R, N, DIM, MAXV);
for (int i = 0; i < NQ; i++) {
double[] v = new double[DIM];
for (int j = 0; j < DIM; j++) {
v[j] = R.nextDouble()*MAXV;
}
ArrayList<PhEntrySF<Object>> exp = nearestNeighborK(ind, 10, v);
// System.out.println("d="+ d + " i=" + i + " minD=" + dist(v, exp));
// System.out.println("v="+ Arrays.toString(v));
// System.out.println("exp="+ Arrays.toString(exp));
List<PhEntrySF<Object>> nnList = toList(q.reset(10, PhDistanceF.THIS, v));
// System.out.println(ind.toStringPlain());
// System.out.println("v =" + Arrays.toString(v));
// System.out.println("exp=" + Arrays.toString(exp));
assertTrue("i=" + i + " d=" + d, !nnList.isEmpty());
check(v, exp, nnList);
}
}
}
示例6: toList
import ch.ethz.globis.phtree.PhTreeSolidF.PhKnnQuerySF; //导入依赖的package包/类
private <T> List<PhEntrySF<T>> toList(PhKnnQuerySF<T> q) {
ArrayList<PhEntrySF<T>> ret = new ArrayList<>();
while (q.hasNext()) {
ret.add(q.nextEntry());
}
return ret;
}
示例7: QueryIteratorKnnPH
import ch.ethz.globis.phtree.PhTreeSolidF.PhKnnQuerySF; //导入依赖的package包/类
private QueryIteratorKnnPH(PhKnnQuerySF<T> iter) {
this.iter = iter;
}