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

qr_online.h
1 /* file: qr_online.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 QR decomposition algorithm in the
19 // online processing mode
20 //--
21 */
22 
23 #ifndef __QR_STREAM_H__
24 #define __QR_STREAM_H__
25 
26 #include "algorithms/algorithm.h"
27 #include "data_management/data/numeric_table.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/qr/qr_types.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
35 namespace qr
36 {
37 
38 namespace interface1
39 {
53 template<typename algorithmFPType, Method method, CpuType cpu>
54 class OnlineContainer : public daal::algorithms::AnalysisContainerIface<online>
55 {
56 public:
62  OnlineContainer(daal::services::Environment::env *daalEnv);
64  virtual ~OnlineContainer();
68  virtual services::Status compute() DAAL_C11_OVERRIDE;
72  virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
73 };
74 
86 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
87 class Online : public daal::algorithms::Analysis<online>
88 {
89 public:
90  typedef OnlinePartialResult PartialResult;
91  typedef OnlinePartialResultPtr PartialResultPtr;
92 
93  typedef algorithms::qr::Input InputType;
94  typedef algorithms::qr::Parameter ParameterType;
95  typedef algorithms::qr::Result ResultType;
96  typedef algorithms::qr::OnlinePartialResult PartialResultType;
97 
98  InputType input;
99  ParameterType parameter;
101  Online()
102  {
103  initialize();
104  }
105 
112  Online(const Online<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
113  {
114  initialize();
115  }
116 
121  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
122 
127  ResultPtr getResult()
128  {
129  return _result;
130  }
131 
136  PartialResultPtr getPartialResult()
137  {
138  return _partialResult;
139  }
140 
145  services::Status setResult(const ResultPtr& res)
146  {
147  DAAL_CHECK(res, services::ErrorNullResult)
148  _result = res;
149  _res = _result.get();
150  return services::Status();
151  }
152 
159  services::Status setPartialResult(const PartialResultPtr &partialResult, bool initFlag = false)
160  {
161  _partialResult = partialResult;
162  _pres = _partialResult.get();
163  setInitFlag(initFlag);
164  return services::Status();
165  }
166 
172  services::SharedPtr<Online<algorithmFPType, method> > clone() const
173  {
174  return services::SharedPtr<Online<algorithmFPType, method> >(cloneImpl());
175  }
176 
177 protected:
178  virtual Online<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
179  {
180  return new Online<algorithmFPType, method>(*this);
181  }
182 
183  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
184  {
185  _result.reset(new ResultType());
186  services::Status s = _result->allocate<algorithmFPType>(_pres, 0, 0);
187  _res = _result.get();
188  return s;
189  }
190 
191  virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
192  {
193  _partialResult.reset(new PartialResultType());
194  services::Status s = _partialResult->allocate<algorithmFPType>(_in, 0, 0);
195  _pres = _partialResult.get();
196  return s;
197  }
198 
199  virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
200  {
201  services::Status s = _partialResult->initialize<algorithmFPType>(_in, 0, 0);
202  _pres = _partialResult.get();
203  return s;
204  }
205 
206  void initialize()
207  {
208  Analysis<online>::_ac = new __DAAL_ALGORITHM_CONTAINER(online, OnlineContainer, algorithmFPType, method)(&_env);
209  _in = &input;
210  _par = &parameter;
211  }
212 
213 private:
214  PartialResultPtr _partialResult;
215  ResultPtr _result;
216 };
218 } // namespace interface1
219 using interface1::OnlineContainer;
220 using interface1::Online;
221 
222 } // namespace daal::algorithms::qr
223 } // namespace daal::algorithms
224 } // namespace daal
225 #endif
daal::algorithms::qr::interface1::Online::input
InputType input
Definition: qr_online.h:98
daal::algorithms::qr::interface1::OnlinePartialResult
Provides methods to access partial results obtained with the compute() method of the QR decomposition...
Definition: qr_types.h:295
daal::algorithms::qr::interface1::OnlineContainer::finalizeCompute
virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE
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::qr::interface1::Online::setResult
services::Status setResult(const ResultPtr &res)
Definition: qr_online.h:145
daal::algorithms::qr::interface1::Online::parameter
ParameterType parameter
Definition: qr_online.h:99
daal::algorithms::qr::interface1::OnlineContainer::~OnlineContainer
virtual ~OnlineContainer()
daal::algorithms::qr::interface1::OnlineContainer::OnlineContainer
OnlineContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::qr::interface1::Online::getResult
ResultPtr getResult()
Definition: qr_online.h:127
daal::algorithms::qr::interface1::Online
Computes the results of the QR decomposition algorithm in the online processing mode.
Definition: qr_online.h:87
daal_defines.h
daal::algorithms::qr::interface1::Online::getPartialResult
PartialResultPtr getPartialResult()
Definition: qr_online.h:136
daal::algorithms::qr::interface1::Online::Online
Online(const Online< algorithmFPType, method > &other)
Definition: qr_online.h:112
daal::algorithms::qr::interface1::Online::clone
services::SharedPtr< Online< algorithmFPType, method > > clone() const
Definition: qr_online.h:172
daal::algorithms::qr::interface1::Online::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: qr_online.h:121
daal::algorithms::qr::interface1::OnlineContainer::compute
virtual services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::qr::interface1::Online::setPartialResult
services::Status setPartialResult(const PartialResultPtr &partialResult, bool initFlag=false)
Definition: qr_online.h:159
daal::online
Definition: daal_defines.h:112
daal::algorithms::qr::interface1::OnlineContainer
Provides methods to run implementations of the QR decomposition algorithm in the online processing mo...
Definition: qr_online.h:54
daal::services::ErrorNullResult
Definition: error_indexes.h:96

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