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

low_order_moments_online.h
1 /* file: low_order_moments_online.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 // online processing mode
46 //--
47 */
48 
49 #ifndef __LOW_ORDER_MOMENTS_ONLINE_H__
50 #define __LOW_ORDER_MOMENTS_ONLINE_H__
51 
52 #include "algorithms/algorithm.h"
53 #include "services/daal_defines.h"
54 #include "algorithms/moments/low_order_moments_types.h"
55 
56 namespace daal
57 {
58 namespace algorithms
59 {
60 namespace low_order_moments
61 {
62 
63 namespace interface1
64 {
79 template<typename algorithmFPType, Method method, CpuType cpu>
80 class DAAL_EXPORT OnlineContainer : public daal::algorithms::AnalysisContainerIface<online>
81 {
82 public:
88  OnlineContainer(daal::services::Environment::env *daalEnv);
90  virtual ~OnlineContainer();
95  virtual services::Status compute() DAAL_C11_OVERRIDE;
100  virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
101 };
102 
117 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
118 class DAAL_EXPORT Online : public daal::algorithms::Analysis<online>
119 {
120 public:
121  Input input;
122  Parameter parameter;
125  Online()
126  {
127  initialize();
128  }
129 
136  Online(const Online<algorithmFPType, method> &other) : parameter(other.parameter), input(other.input)
137  {
138  initialize();
139  }
140 
145  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
146 
151  ResultPtr getResult()
152  {
153  return _result;
154  }
155 
160  services::Status setResult(const ResultPtr &result)
161  {
162  DAAL_CHECK(result, services::ErrorNullResult)
163  _result = result;
164  _res = _result.get();
165  return services::Status();
166  }
167 
172  PartialResultPtr getPartialResult()
173  {
174  return _partialResult;
175  }
176 
182  services::Status setPartialResult(const PartialResultPtr &partialResult, bool initFlag = false)
183  {
184  _partialResult = partialResult;
185  _pres = _partialResult.get();
186  setInitFlag(initFlag);
187  return services::Status();
188  }
189 
195  services::SharedPtr<Online<algorithmFPType, method> > clone() const
196  {
197  return services::SharedPtr<Online<algorithmFPType, method> >(cloneImpl());
198  }
199 
200 protected:
201  virtual Online<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
202  {
203  return new Online<algorithmFPType, method>(*this);
204  }
205 
206  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
207  {
208  services::Status s = _result->allocate<algorithmFPType>(_in, 0, 0);
209  _res = _result.get();
210  _pres = _partialResult.get();
211  return s;
212  }
213 
214  virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
215  {
216  services::Status s = _partialResult->allocate<algorithmFPType>(_in, 0, 0);
217  _pres = _partialResult.get();
218  return s;
219  }
220 
221  virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
222  {
223  services::Status s = _partialResult->initialize<algorithmFPType>(_in, 0, 0);
224  _pres = _partialResult.get();
225  return s;
226  }
227 
228  void initialize()
229  {
230  Analysis<online>::_ac = new __DAAL_ALGORITHM_CONTAINER(online, OnlineContainer, algorithmFPType, method)(&_env);
231  _in = &input;
232  _par = &parameter;
233  _result.reset(new Result());
234  _partialResult.reset(new PartialResult());
235  }
236 
237 private:
238  PartialResultPtr _partialResult;
239  ResultPtr _result;
240 };
242 } // namespace interface1
243 using interface1::OnlineContainer;
244 using interface1::Online;
245 
246 } // namespace daal::algorithms::low_order_moments
247 }
248 }
249 #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::Online::clone
services::SharedPtr< Online< algorithmFPType, method > > clone() const
Definition: low_order_moments_online.h:195
daal::algorithms::low_order_moments::interface1::Online::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: low_order_moments_online.h:145
daal::algorithms::low_order_moments::interface1::Online::setPartialResult
services::Status setPartialResult(const PartialResultPtr &partialResult, bool initFlag=false)
Definition: low_order_moments_online.h:182
daal::algorithms::low_order_moments::interface1::Online::setResult
services::Status setResult(const ResultPtr &result)
Definition: low_order_moments_online.h:160
daal::algorithms::low_order_moments::interface1::Online
Computes moments of low order in the online processing mode.
Definition: low_order_moments_online.h:118
daal::algorithms::low_order_moments::interface1::OnlineContainer
Provides methods to run implementations of the low order moments algorithm. This class is associated ...
Definition: low_order_moments_online.h:80
daal::algorithms::low_order_moments::interface1::Online::getPartialResult
PartialResultPtr getPartialResult()
Definition: low_order_moments_online.h:172
daal::algorithms::low_order_moments::interface1::Online::getResult
ResultPtr getResult()
Definition: low_order_moments_online.h:151
daal_defines.h
daal::algorithms::low_order_moments::interface1::Online::Online
Online(const Online< algorithmFPType, method > &other)
Definition: low_order_moments_online.h:136
daal::algorithms::low_order_moments::interface1::Parameter
Low order moments algorithm parameters.
Definition: low_order_moments_types.h:293
daal::algorithms::low_order_moments::interface1::Online::parameter
Parameter parameter
Definition: low_order_moments_online.h:122
daal::algorithms::low_order_moments::interface1::Online::Online
Online()
Definition: low_order_moments_online.h:125
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:94
daal::online
Definition: daal_defines.h:133
daal::algorithms::low_order_moments::interface1::Input
Input objects for the low order moments algorithm
Definition: low_order_moments_types.h:173
daal::services::ErrorNullResult
Definition: error_indexes.h:122
daal::algorithms::low_order_moments::interface1::Online::input
Input input
Definition: low_order_moments_online.h:121

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