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

low_order_moments_batch.h
1 /* file: low_order_moments_batch.h */
2 /*******************************************************************************
3 * Copyright 2014-2017 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of the interface for the low order moments algorithm in the
45 // batch processing mode
46 //--
47 */
48 
49 #ifndef __LOW_ORDER_MOMENTS_BATCH_H__
50 #define __LOW_ORDER_MOMENTS_BATCH_H__
51 
52 #include "algorithms/algorithm.h"
53 #include "data_management/data/numeric_table.h"
54 #include "services/daal_defines.h"
55 #include "algorithms/moments/low_order_moments_types.h"
56 
57 namespace daal
58 {
59 namespace algorithms
60 {
61 namespace low_order_moments
62 {
63 
64 namespace interface1
65 {
75 class BatchContainerIface : public daal::algorithms::AnalysisContainerIface<batch>
76 {
77 public:
78  BatchContainerIface() {};
79  virtual ~BatchContainerIface() {}
80 
84  virtual services::Status compute() = 0;
85 };
95 template<typename algorithmFPType, Method method, CpuType cpu>
96 class DAAL_EXPORT BatchContainer : public BatchContainerIface
97 {
98 public:
104  BatchContainer(daal::services::Environment::env *daalEnv);
106  virtual ~BatchContainer();
110  virtual services::Status compute() DAAL_C11_OVERRIDE;
111 };
112 
118 class DAAL_EXPORT BatchImpl : public daal::algorithms::Analysis<batch>
119 {
120 public:
122  BatchImpl()
123  {
124  initialize();
125  };
126 
133  BatchImpl(const BatchImpl &other) : parameter(other.parameter), input(other.input)
134  {
135  initialize();
136  }
137 
142  ResultPtr getResult()
143  {
144  return _result;
145  };
146 
151  virtual services::Status setResult(const ResultPtr &result)
152  {
153  DAAL_CHECK(result, services::ErrorNullResult)
154  _result = result;
155  _res = _result.get();
156  return services::Status();
157  }
158 
164  services::SharedPtr<BatchImpl> clone() const
165  {
166  return services::SharedPtr<BatchImpl>(cloneImpl());
167  }
168 
169  virtual ~BatchImpl() {}
170 
171  Input input;
172  Parameter parameter;
174 protected:
175  ResultPtr _result;
176 
177  void initialize()
178  {
179  _result.reset(new Result());
180  _in = &input;
181  _par = &parameter;
182  }
183  virtual BatchImpl *cloneImpl() const DAAL_C11_OVERRIDE = 0;
184 };
185 
203 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
204 class DAAL_EXPORT Batch : public BatchImpl
205 {
206 public:
208  Batch()
209  {
210  initialize();
211  }
212 
219  Batch(const Batch<algorithmFPType, method> &other) : BatchImpl(other)
220  {
221  initialize();
222  }
223 
224  virtual ~Batch() {}
225 
230  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
231 
237  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
238  {
239  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
240  }
241 
242 protected:
243  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
244  {
245  return new Batch<algorithmFPType, method>(*this);
246  }
247 
248  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
249  {
250  services::Status s = _result->allocate<algorithmFPType>(&input, 0, 0);
251  _res = _result.get();
252  return s;
253  }
254 
255  void initialize()
256  {
257  this->_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
258  }
259 };
261 } // namespace interface1
262 using interface1::BatchContainerIface;
263 using interface1::BatchContainer;
264 using interface1::BatchImpl;
265 using interface1::Batch;
266 
267 } // namespace daal::algorithms::low_order_moments
268 }
269 } // namespace daal
270 #endif
daal
Definition: algorithm_base_common.h:57
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:79
daal::algorithms::low_order_moments::interface1::BatchImpl::clone
services::SharedPtr< BatchImpl > clone() const
Definition: low_order_moments_batch.h:164
daal::algorithms::low_order_moments::defaultDense
Definition: low_order_moments_types.h:74
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:208
daal::algorithms::low_order_moments::interface1::BatchImpl::BatchImpl
BatchImpl()
Definition: low_order_moments_batch.h:122
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:75
daal::algorithms::low_order_moments::interface1::Result
Provides methods to access final results obtained with the compute() method of the low order moments ...
Definition: low_order_moments_types.h:308
daal::algorithms::low_order_moments::interface1::BatchImpl::input
Input input
Definition: low_order_moments_batch.h:171
daal::algorithms::low_order_moments::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: low_order_moments_batch.h:219
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:118
daal_defines.h
daal::algorithms::low_order_moments::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: low_order_moments_batch.h:230
daal::batch
Definition: daal_defines.h:131
daal::algorithms::low_order_moments::interface1::BatchImpl::getResult
ResultPtr getResult()
Definition: low_order_moments_batch.h:142
daal::algorithms::low_order_moments::interface1::Parameter
Low order moments algorithm parameters.
Definition: low_order_moments_types.h:293
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:94
daal::algorithms::low_order_moments::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: low_order_moments_batch.h:237
daal::algorithms::low_order_moments::interface1::Batch
Computes moments of low order in the batch processing mode.
Definition: low_order_moments_batch.h:204
daal::algorithms::low_order_moments::interface1::BatchImpl::parameter
Parameter parameter
Definition: low_order_moments_batch.h:172
daal::algorithms::low_order_moments::interface1::BatchImpl::setResult
virtual services::Status setResult(const ResultPtr &result)
Definition: low_order_moments_batch.h:151
daal::algorithms::low_order_moments::interface1::Input
Input objects for the low order moments algorithm
Definition: low_order_moments_types.h:173
daal::algorithms::low_order_moments::interface1::BatchImpl::BatchImpl
BatchImpl(const BatchImpl &other)
Definition: low_order_moments_batch.h:133
daal::algorithms::low_order_moments::Method
Method
Definition: low_order_moments_types.h:72
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:96
daal::services::ErrorNullResult
Definition: error_indexes.h:122

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