C++ API Reference for Intel® Data Analytics Acceleration Library 2019 Update 4

low_order_moments_batch.h
1 /* file: low_order_moments_batch.h */
2 /*******************************************************************************
3 * Copyright 2014-2019 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 low order moments algorithm in the
19 // batch processing mode
20 //--
21 */
22 
23 #ifndef __LOW_ORDER_MOMENTS_BATCH_H__
24 #define __LOW_ORDER_MOMENTS_BATCH_H__
25 
26 #include "algorithms/algorithm.h"
27 #include "data_management/data/numeric_table.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/moments/low_order_moments_types.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
35 namespace low_order_moments
36 {
37 
38 namespace interface1
39 {
49 class BatchContainerIface : public daal::algorithms::AnalysisContainerIface<batch>
50 {
51 public:
52  BatchContainerIface() {};
53  virtual ~BatchContainerIface() {}
54 
58  virtual services::Status compute() = 0;
59 };
69 template<typename algorithmFPType, Method method, CpuType cpu>
70 class DAAL_EXPORT BatchContainer : public BatchContainerIface
71 {
72 public:
78  BatchContainer(daal::services::Environment::env *daalEnv);
80  virtual ~BatchContainer();
84  virtual services::Status compute() DAAL_C11_OVERRIDE;
85 };
86 
92 class DAAL_EXPORT BatchImpl : public daal::algorithms::Analysis<batch>
93 {
94 public:
95  typedef algorithms::low_order_moments::Input InputType;
96  typedef algorithms::low_order_moments::Parameter ParameterType;
97  typedef algorithms::low_order_moments::Result ResultType;
98 
100  BatchImpl()
101  {
102  initialize();
103  };
104 
111  BatchImpl(const BatchImpl &other) : parameter(other.parameter), input(other.input)
112  {
113  initialize();
114  }
115 
120  ResultPtr getResult()
121  {
122  return _result;
123  };
124 
129  virtual services::Status setResult(const ResultPtr &result)
130  {
131  DAAL_CHECK(result, services::ErrorNullResult)
132  _result = result;
133  _res = _result.get();
134  return services::Status();
135  }
136 
142  services::SharedPtr<BatchImpl> clone() const
143  {
144  return services::SharedPtr<BatchImpl>(cloneImpl());
145  }
146 
147  virtual ~BatchImpl() {}
148 
149  InputType input;
150  ParameterType parameter;
152 protected:
153  ResultPtr _result;
154 
155  void initialize()
156  {
157  _result.reset(new ResultType());
158  _in = &input;
159  _par = &parameter;
160  }
161  virtual BatchImpl *cloneImpl() const DAAL_C11_OVERRIDE = 0;
162 };
163 
181 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
182 class DAAL_EXPORT Batch : public BatchImpl
183 {
184 public:
185  typedef BatchImpl super;
186 
187  typedef typename super::InputType InputType;
188  typedef typename super::ParameterType ParameterType;
189  typedef typename super::ResultType ResultType;
190 
192  Batch()
193  {
194  initialize();
195  }
196 
203  Batch(const Batch<algorithmFPType, method> &other) : BatchImpl(other)
204  {
205  initialize();
206  }
207 
208  virtual ~Batch() {}
209 
214  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
215 
221  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
222  {
223  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
224  }
225 
226 protected:
227  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
228  {
229  return new Batch<algorithmFPType, method>(*this);
230  }
231 
232  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
233  {
234  services::Status s = _result->allocate<algorithmFPType>(&input, 0, 0);
235  _res = _result.get();
236  return s;
237  }
238 
239  void initialize()
240  {
241  this->_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
242  }
243 };
245 } // namespace interface1
246 using interface1::BatchContainerIface;
247 using interface1::BatchContainer;
248 using interface1::BatchImpl;
249 using interface1::Batch;
250 
251 } // namespace daal::algorithms::low_order_moments
252 }
253 } // namespace daal
254 #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::low_order_moments::interface1::BatchImpl::clone
services::SharedPtr< BatchImpl > clone() const
Definition: low_order_moments_batch.h:142
daal::algorithms::low_order_moments::defaultDense
Definition: low_order_moments_types.h:48
daal::algorithms::low_order_moments::interface1::BatchContainerIface::compute
virtual services::Status compute()=0
daal::algorithms::low_order_moments::interface1::Batch::Batch
Batch()
Definition: low_order_moments_batch.h:192
daal::algorithms::low_order_moments::interface1::BatchImpl::BatchImpl
BatchImpl()
Definition: low_order_moments_batch.h:100
daal::algorithms::low_order_moments::interface1::BatchContainerIface
Class that specifies interfaces of implementations of the low order moments algorithm.
Definition: low_order_moments_batch.h:49
daal::algorithms::low_order_moments::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: low_order_moments_batch.h:203
daal::algorithms::low_order_moments::interface1::BatchImpl
Abstract class that specifies interface of the algorithms for computing moments of low order in the b...
Definition: low_order_moments_batch.h:92
daal_defines.h
daal::algorithms::low_order_moments::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: low_order_moments_batch.h:214
daal::batch
Definition: daal_defines.h:110
daal::algorithms::low_order_moments::interface1::BatchImpl::getResult
ResultPtr getResult()
Definition: low_order_moments_batch.h:120
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::low_order_moments::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: low_order_moments_batch.h:221
daal::algorithms::low_order_moments::interface1::Batch
Computes moments of low order in the batch processing mode.
Definition: low_order_moments_batch.h:182
daal::algorithms::low_order_moments::interface1::BatchImpl::parameter
ParameterType parameter
Definition: low_order_moments_batch.h:150
daal::algorithms::low_order_moments::interface1::BatchImpl::setResult
virtual services::Status setResult(const ResultPtr &result)
Definition: low_order_moments_batch.h:129
daal::algorithms::low_order_moments::interface1::BatchImpl::BatchImpl
BatchImpl(const BatchImpl &other)
Definition: low_order_moments_batch.h:111
daal::algorithms::low_order_moments::Method
Method
Definition: low_order_moments_types.h:46
daal::algorithms::low_order_moments::interface1::BatchContainer
Provides methods to run implementations of the low order moments algorithm. This class is associated ...
Definition: low_order_moments_batch.h:70
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::low_order_moments::interface1::BatchImpl::input
InputType input
Definition: low_order_moments_batch.h:149

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