当前位置: 首页>>代码示例>>Java>>正文


Java PhKnnQuerySF类代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:tzaeschke,项目名称:phtree,代码行数:27,代码来源:TestNearestNeighbourFS.java

示例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);
		}
	}
}
 
开发者ID:tzaeschke,项目名称:phtree,代码行数:27,代码来源:TestNearestNeighbourFS.java

示例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);
		}
	}
}
 
开发者ID:tzaeschke,项目名称:phtree,代码行数:33,代码来源:TestNearestNeighbourFS.java

示例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);
		}
	}
}
 
开发者ID:tzaeschke,项目名称:phtree,代码行数:33,代码来源:TestNearestNeighbourFS.java

示例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);
		}
	}
}
 
开发者ID:tzaeschke,项目名称:phtree,代码行数:32,代码来源:TestNearestNeighbourFS.java

示例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;
}
 
开发者ID:tzaeschke,项目名称:phtree,代码行数:8,代码来源:TestNearestNeighbourFS.java

示例7: QueryIteratorKnnPH

import ch.ethz.globis.phtree.PhTreeSolidF.PhKnnQuerySF; //导入依赖的package包/类
private QueryIteratorKnnPH(PhKnnQuerySF<T> iter) {
	this.iter = iter;
}
 
开发者ID:tzaeschke,项目名称:tinspin-indexes,代码行数:4,代码来源:PHTreeR.java


注:本文中的ch.ethz.globis.phtree.PhTreeSolidF.PhKnnQuerySF类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。