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

qr_online.h
1 /* file: qr_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 QR decomposition algorithm in the
45 // online processing mode
46 //--
47 */
48 
49 #ifndef __QR_STREAM_H__
50 #define __QR_STREAM_H__
51 
52 #include "algorithms/algorithm.h"
53 #include "data_management/data/numeric_table.h"
54 #include "services/daal_defines.h"
55 #include "algorithms/qr/qr_types.h"
56 
57 namespace daal
58 {
59 namespace algorithms
60 {
61 namespace qr
62 {
63 
64 namespace interface1
65 {
79 template<typename algorithmFPType, Method method, CpuType cpu>
80 class OnlineContainer : public daal::algorithms::AnalysisContainerIface<online>
81 {
82 public:
88  OnlineContainer(daal::services::Environment::env *daalEnv);
90  virtual ~OnlineContainer();
94  virtual services::Status compute() DAAL_C11_OVERRIDE;
98  virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
99 };
100 
112 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
113 class Online : public daal::algorithms::Analysis<online>
114 {
115 public:
116  typedef OnlinePartialResult PartialResult;
117  typedef OnlinePartialResultPtr PartialResultPtr;
118 
119  Input input;
120  Parameter parameter;
122  Online()
123  {
124  initialize();
125  }
126 
133  Online(const Online<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
134  {
135  initialize();
136  }
137 
142  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
143 
148  ResultPtr getResult()
149  {
150  return _result;
151  }
152 
157  PartialResultPtr getPartialResult()
158  {
159  return _partialResult;
160  }
161 
166  services::Status setResult(const ResultPtr& res)
167  {
168  DAAL_CHECK(res, services::ErrorNullResult)
169  _result = res;
170  _res = _result.get();
171  return services::Status();
172  }
173 
180  services::Status setPartialResult(const PartialResultPtr &partialResult, bool initFlag = false)
181  {
182  _partialResult = partialResult;
183  _pres = _partialResult.get();
184  setInitFlag(initFlag);
185  return services::Status();
186  }
187 
193  services::SharedPtr<Online<algorithmFPType, method> > clone() const
194  {
195  return services::SharedPtr<Online<algorithmFPType, method> >(cloneImpl());
196  }
197 
198 protected:
199  virtual Online<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
200  {
201  return new Online<algorithmFPType, method>(*this);
202  }
203 
204  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
205  {
206  _result.reset(new Result());
207  services::Status s = _result->allocate<algorithmFPType>(_pres, 0, 0);
208  _res = _result.get();
209  return s;
210  }
211 
212  virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
213  {
214  _partialResult.reset(new PartialResult());
215  services::Status s = _partialResult->allocate<algorithmFPType>(_in, 0, 0);
216  _pres = _partialResult.get();
217  return s;
218  }
219 
220  virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
221  {
222  services::Status s = _partialResult->initialize<algorithmFPType>(_in, 0, 0);
223  _pres = _partialResult.get();
224  return s;
225  }
226 
227  void initialize()
228  {
229  Analysis<online>::_ac = new __DAAL_ALGORITHM_CONTAINER(online, OnlineContainer, algorithmFPType, method)(&_env);
230  _in = &input;
231  _par = &parameter;
232  }
233 
234 private:
235  PartialResultPtr _partialResult;
236  ResultPtr _result;
237 };
239 } // namespace interface1
240 using interface1::OnlineContainer;
241 using interface1::Online;
242 
243 } // namespace daal::algorithms::qr
244 } // namespace daal::algorithms
245 } // namespace daal
246 #endif
daal::algorithms::qr::interface1::OnlinePartialResult
Provides methods to access partial results obtained with the compute() method of the QR decomposition...
Definition: qr_types.h:321
daal::algorithms::qr::interface1::OnlineContainer::finalizeCompute
virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE
daal
Definition: algorithm_base_common.h:57
daal::algorithms::qr::interface1::Online::input
Input input
Definition: qr_online.h:119
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:79
daal::algorithms::qr::interface1::Parameter
Parameters for the QR decomposition compute method.
Definition: qr_types.h:662
daal::algorithms::qr::interface1::Online::setResult
services::Status setResult(const ResultPtr &res)
Definition: qr_online.h:166
daal::algorithms::qr::interface1::Online::parameter
Parameter parameter
Definition: qr_online.h:120
daal::algorithms::qr::interface1::OnlineContainer::~OnlineContainer
virtual ~OnlineContainer()
daal::algorithms::qr::interface1::Input
Input objects for the QR decomposition algorithm in the batch and online processing modes and for the...
Definition: qr_types.h:186
daal::algorithms::qr::interface1::OnlineContainer::OnlineContainer
OnlineContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::qr::interface1::Online::getResult
ResultPtr getResult()
Definition: qr_online.h:148
daal::algorithms::qr::interface1::Online
Computes the results of the QR decomposition algorithm in the online processing mode.
Definition: qr_online.h:113
daal_defines.h
daal::algorithms::qr::interface1::Online::getPartialResult
PartialResultPtr getPartialResult()
Definition: qr_online.h:157
daal::algorithms::qr::interface1::Online::Online
Online(const Online< algorithmFPType, method > &other)
Definition: qr_online.h:133
daal::algorithms::qr::interface1::Online::clone
services::SharedPtr< Online< algorithmFPType, method > > clone() const
Definition: qr_online.h:193
daal::algorithms::qr::interface1::Online::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: qr_online.h:142
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:94
daal::algorithms::qr::interface1::Online::setPartialResult
services::Status setPartialResult(const PartialResultPtr &partialResult, bool initFlag=false)
Definition: qr_online.h:180
daal::online
Definition: daal_defines.h:133
daal::algorithms::qr::interface1::OnlineContainer
Provides methods to run implementations of the QR decomposition algorithm in the online processing mo...
Definition: qr_online.h:80
daal::services::ErrorNullResult
Definition: error_indexes.h:122

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