/** * Builds a dim-1 dimensional database where the objects are projected into * the specified subspace. * * @param dim the dimensionality of the database * @param basis the basis defining the subspace * @param ids the ids for the new database * @param relation the database storing the parameterization functions * @return a dim-1 dimensional database where the objects are projected into * the specified subspace */ private MaterializedRelation<ParameterizationFunction> buildDB(int dim, double[][] basis, DBIDs ids, Relation<ParameterizationFunction> relation) { ProxyDatabase proxy = new ProxyDatabase(ids); SimpleTypeInformation<ParameterizationFunction> type = new SimpleTypeInformation<>(ParameterizationFunction.class); WritableDataStore<ParameterizationFunction> prep = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT, ParameterizationFunction.class); // Project for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { prep.put(iter, project(basis, relation.get(iter))); } if(LOG.isDebugging()) { LOG.debugFine("db fuer dim " + (dim - 1) + ": " + ids.size()); } MaterializedRelation<ParameterizationFunction> prel = new MaterializedRelation<>(type, ids, null, prep); proxy.addRelation(prel); return prel; }
/** * Builds a dim-1 dimensional database where the objects are projected into * the specified subspace. * * @param dim the dimensionality of the database * @param basis the basis defining the subspace * @param ids the ids for the new database * @param relation the database storing the parameterization functions * @return a dim-1 dimensional database where the objects are projected into * the specified subspace */ private MaterializedRelation<ParameterizationFunction> buildDB(int dim, Matrix basis, DBIDs ids, Relation<ParameterizationFunction> relation) { ProxyDatabase proxy = new ProxyDatabase(ids); SimpleTypeInformation<ParameterizationFunction> type = new SimpleTypeInformation<>(ParameterizationFunction.class); WritableDataStore<ParameterizationFunction> prep = DataStoreUtil.makeStorage(ids, DataStoreFactory.HINT_HOT, ParameterizationFunction.class); // Project for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { prep.put(iter, project(basis, relation.get(iter))); } if(LOG.isDebugging()) { LOG.debugFine("db fuer dim " + (dim - 1) + ": " + ids.size()); } MaterializedRelation<ParameterizationFunction> prel = new MaterializedRelation<>(type, ids, null, prep); proxy.addRelation(prel); return prel; }