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

sorting_batch.h
1 /* file: sorting_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 observation sorting algorithm
21 // in the batch processing mode
22 //--
23 */
24 
25 #ifndef __SORTING_BATCH_H__
26 #define __SORTING_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/sorting/sorting_types.h"
32 
33 namespace daal
34 {
35 namespace algorithms
36 {
37 namespace sorting
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::sorting::Input InputType;
92  typedef algorithms::sorting::Result ResultType;
93 
94  InputType input;
97  Batch()
98  {
99  initialize();
100  }
101 
108  Batch(const Batch<algorithmFPType, method> &other) : input(other.input)
109  {
110  initialize();
111  }
112 
113  virtual ~Batch() {}
114 
119  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
120 
125  ResultPtr getResult()
126  {
127  return _result;
128  }
129 
134  services::Status setResult(const ResultPtr &result)
135  {
136  DAAL_CHECK(result, services::ErrorNullResult)
137  _result = result;
138  _res = _result.get();
139  return services::Status();
140  }
141 
147  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
148  {
149  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
150  }
151 
152 protected:
153  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
154  {
155  return new Batch<algorithmFPType, method>(*this);
156  }
157 
158  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
159  {
160  services::Status s = _result->allocate<algorithmFPType>(&input, method);
161  _res = _result.get();
162  return s;
163  }
164 
165  void initialize()
166  {
167  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
168  _in = &input;
169  _result.reset(new ResultType());
170  }
171 
172  ResultPtr _result;
173 
174 };
176 } // namespace interface1
177 using interface1::BatchContainer;
178 using interface1::Batch;
179 
180 } // namespace daal::algorithms::sorting
181 } // namespace daal::algorithms
182 } // namespace daal
183 #endif
daal::algorithms::sorting::interface1::BatchContainer::~BatchContainer
virtual ~BatchContainer()
daal::algorithms::sorting::interface1::Batch::input
InputType input
Definition: sorting_batch.h:94
daal::algorithms::sorting::interface1::BatchContainer::compute
virtual services::Status compute() DAAL_C11_OVERRIDE
daal::batch
Definition: daal_defines.h:112
daal::algorithms::sorting::interface1::BatchContainer
Provides methods to run implementations of the sorting algorithm. It is associated with the daal::alg...
Definition: sorting_batch.h:57
daal::algorithms::sorting::interface1::Batch
Sorts the datasets by components of the random vector in the batch processing mode.
Definition: sorting_batch.h:88
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::sorting::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: sorting_batch.h:147
daal::algorithms::sorting::interface1::Batch::getResult
ResultPtr getResult()
Definition: sorting_batch.h:125
daal_defines.h
daal::algorithms::sorting::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: sorting_batch.h:108
daal::algorithms::sorting::interface1::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::sorting::interface1::Batch::Batch
Batch()
Definition: sorting_batch.h:97
daal::algorithms::sorting::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: sorting_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::sorting::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: sorting_batch.h:134

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