C++ API Reference for Intel® Data Analytics Acceleration Library 2018 Update 3

quantiles_batch.h
1 /* file: quantiles_batch.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 Intel Corporation.
4 *
5 * This software and the related documents are Intel copyrighted materials, and
6 * your use of them is governed by the express license under which they were
7 * provided to you (License). Unless the License provides otherwise, you may not
8 * use, modify, copy, publish, distribute, disclose or transmit this software or
9 * the related documents without Intel's prior written permission.
10 *
11 * This software and the related documents are provided as is, with no express
12 * or implied warranties, other than those that are expressly stated in the
13 * License.
14 *******************************************************************************/
15 
16 /*
17 //++
18 // Implementation of the interface for the quantiles algorithm in the batch processing mode
19 //--
20 */
21 
22 #ifndef __QUANTILES_BATCH_H__
23 #define __QUANTILES_BATCH_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/numeric_table.h"
27 #include "services/daal_defines.h"
28 #include "algorithms/quantiles/quantiles_types.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 namespace quantiles
35 {
36 
37 namespace interface1
38 {
53 template<typename algorithmFPType, Method method, CpuType cpu>
54 class DAAL_EXPORT BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
55 {
56 public:
62  BatchContainer(daal::services::Environment::env *daalEnv);
64  virtual ~BatchContainer();
68  virtual services::Status compute() DAAL_C11_OVERRIDE;
69 };
70 
84 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
85 class DAAL_EXPORT Batch : public daal::algorithms::Analysis<batch>
86 {
87 public:
88  typedef algorithms::quantiles::Input InputType;
89  typedef algorithms::quantiles::Parameter ParameterType;
90  typedef algorithms::quantiles::Result ResultType;
91 
92  InputType input;
93  ParameterType parameter;
96  Batch()
97  {
98  initialize();
99  }
100 
107  Batch(const Batch<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
108  {
109  initialize();
110  }
111 
112  virtual ~Batch() {}
113 
118  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
119 
124  ResultPtr getResult()
125  {
126  return _result;
127  }
128 
133  services::Status setResult(const ResultPtr &result)
134  {
135  DAAL_CHECK(result, services::ErrorNullResult)
136  if(!result) return services::Status(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, &parameter, 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  _par = &parameter;
170  _result.reset(new ResultType());
171  }
172 
173  ResultPtr _result;
174 };
176 } // namespace interface1
177 using interface1::BatchContainer;
178 using interface1::Batch;
179 
180 } // namespace daal::algorithms::quantiles
181 } // namespace daal::algorithms
182 } // namespace daal
183 #endif
daal
Definition: algorithm_base_common.h:31
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:53
daal::algorithms::quantiles::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: quantiles_batch.h:133
daal::algorithms::quantiles::interface1::Batch::input
InputType input
Definition: quantiles_batch.h:92
daal::algorithms::quantiles::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: quantiles_batch.h:147
daal_defines.h
daal::algorithms::quantiles::interface1::Batch::parameter
ParameterType parameter
Definition: quantiles_batch.h:93
daal::batch
Definition: daal_defines.h:106
daal::algorithms::quantiles::interface1::Batch
Computes values of quantiles in the batch processing mode.
Definition: quantiles_batch.h:85
daal::algorithms::quantiles::interface1::BatchContainer
Provides methods to run implementations of the quantiles algorithm. It is associated with the daal::a...
Definition: quantiles_batch.h:54
daal::algorithms::quantiles::interface1::Batch::getResult
ResultPtr getResult()
Definition: quantiles_batch.h:124
daal::algorithms::quantiles::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: quantiles_batch.h:107
daal::algorithms::quantiles::interface1::Batch::Batch
Batch()
Definition: quantiles_batch.h:96
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::quantiles::quantiles
Definition: quantiles_types.h:67
daal::algorithms::quantiles::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: quantiles_batch.h:118

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