Changes

Jump to: navigation, search

SLEEPy

1,437 bytes added, 18:11, 10 April 2016
Batch Sorting
== Code Examples ==
=== Batch Sorting ===
 
<syntaxhighlight lang="c" line="1" >
/* file: sorting_batch.cpp
* Copyright 2014-2016 Intel Corporation All Rights Reserved.*/
 
#include "daal.h"
#include "service.h"
 
using namespace daal;
using namespace daal::algorithms;
using namespace daal::data_management;
using namespace std;
 
/* Input data set parameters */
string datasetFileName = "../data/batch/sorting.csv";
 
int main(int argc, char *argv[])
{
checkArguments(argc, argv, 1, &datasetFileName);
 
/* Initialize FileDataSource<CSVFeatureManager> to retrieve the input data from a .csv file */
FileDataSource<CSVFeatureManager> dataSource(datasetFileName, DataSource::doAllocateNumericTable, DataSource::doDictionaryFromContext);
 
/* Retrieve the data from the input file */
dataSource.loadDataBlock();
 
/* Create algorithm objects to sort data using the default (radix) method */
sorting::Batch<> algorithm;
 
/* Print the input observations matrix */
printNumericTable(dataSource.getNumericTable(), "Initial matrix of observations:");
 
/* Set input objects for the algorithm */
algorithm.input.set(sorting::data, dataSource.getNumericTable());
 
/* Sort data observations */
algorithm.compute();
 
/* Get the sorting result */
services::SharedPtr<sorting::Result> res = algorithm.getResult();
 
printNumericTable(res->get(sorting::sortedData), "Sorted matrix of observations:");
 
return 0;
}
 
</syntaxhighlight>
== Useful Link ==
# https://software.intel.com/en-us/daal
1
edit

Navigation menu