C++ API Reference for Intel® Data Analytics Acceleration Library 2020 Update 1

dbscan_batch.h
1 /* file: dbscan_batch.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Implementation of the interface for the DBSCAN algorithm in the batch
21 // processing mode
22 //--
23 */
24 
25 #ifndef __DBSCAN_BATCH_H__
26 #define __DBSCAN_BATCH_H__
27 
28 #include "algorithms/algorithm.h"
29 #include "data_management/data/numeric_table.h"
30 #include "services/daal_defines.h"
31 #include "algorithms/dbscan/dbscan_types.h"
32 
33 namespace daal
34 {
35 namespace algorithms
36 {
37 namespace dbscan
38 {
39 
40 namespace interface1
41 {
56 template<typename algorithmFPType, Method method, CpuType cpu>
57 class BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
58 {
59 public:
65  BatchContainer(daal::services::Environment::env *daalEnv);
67  virtual ~BatchContainer();
71  virtual services::Status compute() DAAL_C11_OVERRIDE;
72 };
73 
87 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
88 class DAAL_EXPORT Batch : public daal::algorithms::Analysis<batch>
89 {
90 public:
91  typedef algorithms::dbscan::Input InputType;
92  typedef algorithms::dbscan::Parameter ParameterType;
93  typedef algorithms::dbscan::Result ResultType;
94 
100  Batch(algorithmFPType epsilon, size_t minObservations);
101 
108  Batch(const Batch<algorithmFPType, method> &other);
109 
110  ~Batch()
111  {
112  delete _par;
113  }
114 
119  ParameterType& parameter() { return *static_cast<ParameterType*>(_par); }
120 
125  const ParameterType& parameter() const { return *static_cast<const ParameterType*>(_par); }
126 
131  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int) method; }
132 
137  ResultPtr getResult()
138  {
139  return _result;
140  }
141 
146  services::Status setResult(const ResultPtr& result)
147  {
148  DAAL_CHECK(result, services::ErrorNullResult)
149  _result = result;
150  _res = _result.get();
151  return services::Status();
152  }
153 
159  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
160  {
161  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
162  }
163 
164 protected:
165  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
166  {
167  return new Batch<algorithmFPType, method>(*this);
168  }
169 
170  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
171  {
172  _result.reset(new ResultType());
173  services::Status s = _result->allocate<algorithmFPType>(_in, _par, (int) method);
174  _res = _result.get();
175  return s;
176  }
177 
178  void initialize()
179  {
180  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
181  _in = &input;
182  _result.reset(new ResultType());
183  }
184 
185 public:
186  InputType input;
188 private:
189  ResultPtr _result;
190 };
192 } // namespace interface1
193 using interface1::BatchContainer;
194 using interface1::Batch;
195 
196 } // namespace daal::algorithms::dbscan
197 } // namespace daal::algorithms
198 } // namespace daal
199 #endif
daal::batch
Definition: daal_defines.h:112
daal::algorithms::dbscan::interface1::Batch::input
InputType input
Definition: dbscan_batch.h:186
daal::algorithms::dbscan::interface1::BatchContainer::compute
virtual services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::dbscan::interface1::Batch
Computes the results of the DBSCAN algorithm in the batch processing mode.
Definition: dbscan_batch.h:88
daal::algorithms::dbscan::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: dbscan_batch.h:159
daal::algorithms::dbscan::interface1::Batch::getResult
ResultPtr getResult()
Definition: dbscan_batch.h:137
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:55
daal::algorithms::dbscan::interface1::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)
daal_defines.h
daal::algorithms::dbscan::interface1::BatchContainer
Provides methods to run implementations of the DBSCAN algorithm. This class is associated with the da...
Definition: dbscan_batch.h:57
daal::algorithms::dbscan::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: dbscan_batch.h:131
daal::algorithms::dbscan::interface1::BatchContainer::~BatchContainer
virtual ~BatchContainer()
daal::algorithms::dbscan::interface1::Batch::parameter
ParameterType & parameter()
Definition: dbscan_batch.h:119
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:70
daal::algorithms::dbscan::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: dbscan_batch.h:146
daal::algorithms::dbscan::interface1::Batch::parameter
const ParameterType & parameter() const
Definition: dbscan_batch.h:125

For more complete information about compiler optimizations, see our Optimization Notice.