Currently,I'm using ELKI to study R-trees. So, i am trying to make database from my set of points. I easily do it with file based database connection:
ListParameterization spatparams = new ListParameterization();
spatparams.addParameter(StaticArrayDatabase.Parameterizer.INDEX_ID,RStarTreeFactory.class);
spatparams.addParameter(AbstractPageFileFactory.Parameterizer.PAGE_SIZE_ID, 300);
spatparams.addParameter(AbstractRStarTreeFactory.Parameterizer.INSERTION_STRATEGY_ID, ApproximativeLeastOverlapInsertionStrategy.class);
Define file:
spatparams.addParameter(FileBasedDatabaseConnection.Parameterizer.INPUT_ID, "test.txt");
test.txt:
2.16130014186383 0.869922393308295 point1
1.95053629423729 2.33018306536426 point2
2.42579304519276 1.25052644952180 point3
Initialize db:
Database db = ClassGenericsUtil.parameterizeOrAbort(StaticArrayDatabase.class, spatparams);
db.initialize();
But i can't understand how to make it from defined variables, like this:
DoubleVector point1 = DoubleVector.FACTORY.newNumberVector(new double[] { 2.16130014186383, 0.869922393308295});
DoubleVector point2 = DoubleVector.FACTORY.newNumberVector(new double[] { 1.95053629423729, 2.33018306536426});
DoubleVector point3 = DoubleVector.FACTORY.newNumberVector(new double[] { 2.42579304519276,1.25052644952180});
Please, can anybody explain me how to create database from defined double vectors?
See the documentation: https://elki-project.github.io/howto/java_api#PureJavaAPI
// Adapter to load data from an existing array.
DatabaseConnection dbc = new ArrayAdapterDatabaseConnection(data);
// Create a database (which may contain multiple relations!)
Database db = new StaticArrayDatabase(dbc, null);
// Load the data into the database (do NOT forget to initialize...)
db.initialize();
Replace the null
with an index factory, if you want index acceleration.