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

qr_types.h
1 /* file: qr_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 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 // Definition of QR common types.
45 //--
46 */
47 
48 
49 #ifndef __QR_TYPES_H__
50 #define __QR_TYPES_H__
51 
52 #include "algorithms/algorithm.h"
53 #include "data_management/data/numeric_table.h"
54 #include "data_management/data/homogen_numeric_table.h"
55 #include "services/daal_defines.h"
56 
57 namespace daal
58 {
59 namespace algorithms
60 {
74 namespace qr
75 {
80 enum Method
81 {
82  defaultDense = 0
83 };
84 
89 enum InputId
90 {
91  data,
92  lastInputId = data
93 };
94 
99 enum ResultId
100 {
101  matrixQ,
102  matrixR,
103  lastResultId = matrixR
104 };
105 
111 enum PartialResultId
112 {
113  outputOfStep1ForStep3,
115  outputOfStep1ForStep2,
117  lastPartialResultId = outputOfStep1ForStep2
118 };
119 
125 enum DistributedPartialResultCollectionId
126 {
127  outputOfStep2ForStep3,
129  lastDistributedPartialResultCollectionId = outputOfStep2ForStep3
130 };
131 
136 enum DistributedPartialResultId
137 {
138  finalResultFromStep2Master = lastDistributedPartialResultCollectionId + 1,
139  lastDistributedPartialResultId = finalResultFromStep2Master
140 };
141 
146 enum DistributedPartialResultStep3Id
147 {
148  finalResultFromStep3,
149  lastDistributedPartialResultStep3Id = finalResultFromStep3
150 };
151 
156 enum MasterInputId
157 {
158  inputOfStep2FromStep1,
160  lastMasterInputId = inputOfStep2FromStep1
161 };
162 
167 enum FinalizeOnLocalInputId
168 {
169  inputOfStep3FromStep1,
171  inputOfStep3FromStep2,
173  lastFinalizeOnLocalInputId = inputOfStep3FromStep2
174 };
175 
179 namespace interface1
180 {
186 class DAAL_EXPORT Input : public daal::algorithms::Input
187 {
188 public:
190  Input();
191 
193  Input(const Input& other);
194 
196  virtual ~Input() {}
197 
203  data_management::NumericTablePtr get(InputId id) const;
204 
210  void set(InputId id, const data_management::NumericTablePtr &value);
211 
212  services::Status getNumberOfColumns(size_t *nFeatures) const;
213 
214  services::Status getNumberOfRows(size_t *nRows) const;
215 
221  virtual services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
222 };
223 
228 class DAAL_EXPORT DistributedStep2Input : public daal::algorithms::Input
229 {
230 public:
232  DistributedStep2Input();
233 
235  DistributedStep2Input(const DistributedStep2Input& other);
236 
241  services::Status getNumberOfColumns(size_t *nFeatures) const;
242 
248  void set(MasterInputId id, const data_management::KeyValueDataCollectionPtr &ptr);
249 
255  data_management::KeyValueDataCollectionPtr get(MasterInputId id) const;
256 
263  void add(MasterInputId id, size_t key, const data_management::DataCollectionPtr &value);
264 
269  size_t getNBlocks();
270 
276  virtual services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
277 };
278 
283 class DAAL_EXPORT DistributedStep3Input : public daal::algorithms::Input
284 {
285 public:
287  DistributedStep3Input();
288 
290  DistributedStep3Input(const DistributedStep3Input& other);
291 
297  data_management::DataCollectionPtr get(FinalizeOnLocalInputId id) const;
298 
304  void set(FinalizeOnLocalInputId id, const data_management::DataCollectionPtr &value);
305 
306  services::Status getSizes(size_t &nFeatures, size_t &nVectors) const;
307 
313  virtual services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
314 };
315 
321 class DAAL_EXPORT OnlinePartialResult : public daal::algorithms::PartialResult
322 {
323 public:
324  DECLARE_SERIALIZABLE_CAST(OnlinePartialResult);
326  OnlinePartialResult();
328  virtual ~OnlinePartialResult() {}
329 
336  template <typename algorithmFPType>
337  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
338 
346  template <typename algorithmFPType>
347  DAAL_EXPORT services::Status initialize(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
348 
355  template <typename algorithmFPType>
356  DAAL_EXPORT services::Status addPartialResultStorage(size_t m, size_t n);
357 
363  data_management::DataCollectionPtr get(PartialResultId id) const;
364 
370  void set(PartialResultId id, const data_management::DataCollectionPtr &value);
371 
378  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
379 
385  virtual services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
386 
392  size_t getNumberOfColumns() const;
393 
398  size_t getNumberOfRows() const;
399 
400 protected:
402  template<typename Archive, bool onDeserialize>
403  services::Status serialImpl(Archive *arch)
404  {
405  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
406  }
407 
408  services::Status checkImpl(const daal::algorithms::Parameter *parameter, int method, size_t nFeatures, size_t nVectors) const;
409 };
410 typedef services::SharedPtr<OnlinePartialResult> OnlinePartialResultPtr;
411 
418 class DAAL_EXPORT Result : public daal::algorithms::Result
419 {
420 public:
421  DECLARE_SERIALIZABLE_CAST(Result);
423  Result();
425  virtual ~Result() {}
426 
432  data_management::NumericTablePtr get(ResultId id) const;
433 
440  template <typename algorithmFPType>
441  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
442 
449  template <typename algorithmFPType>
450  DAAL_EXPORT services::Status allocate(const daal::algorithms::PartialResult *partialResult, daal::algorithms::Parameter *parameter, const int method);
451 
457  void set(ResultId id, const data_management::NumericTablePtr &value);
458 
465  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
466 
473  virtual services::Status check(const daal::algorithms::PartialResult *pres, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
474 
481  template <typename algorithmFPType>
482  DAAL_EXPORT services::Status allocateImpl(size_t m, size_t n);
483 
484 protected:
486  template<typename Archive, bool onDeserialize>
487  services::Status serialImpl(Archive *arch)
488  {
489  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
490  }
491 };
492 typedef services::SharedPtr<Result> ResultPtr;
493 
499 class DAAL_EXPORT DistributedPartialResult : public daal::algorithms::PartialResult
500 {
501 public:
502  DECLARE_SERIALIZABLE_CAST(DistributedPartialResult);
504  DistributedPartialResult();
506  virtual ~DistributedPartialResult() {}
507 
514  template <typename algorithmFPType>
515  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
516 
527  template <typename algorithmFPType>
528  DAAL_EXPORT services::Status setPartialResultStorage(data_management::KeyValueDataCollection *inCollection, size_t &nBlocks);
529 
537  data_management::KeyValueDataCollectionPtr get(DistributedPartialResultCollectionId id) const;
538 
544  ResultPtr get(DistributedPartialResultId id) const;
545 
551  void set(DistributedPartialResultCollectionId id, const data_management::KeyValueDataCollectionPtr &value);
552 
558  void set(DistributedPartialResultId id, const ResultPtr &value);
559 
560 
566  virtual services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
567 
574  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
575 
576 protected:
578  template<typename Archive, bool onDeserialize>
579  services::Status serialImpl(Archive *arch)
580  {
581  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
582  }
583 };
584 typedef services::SharedPtr<DistributedPartialResult>DistributedPartialResultPtr;
585 
591 class DAAL_EXPORT DistributedPartialResultStep3 : public daal::algorithms::PartialResult
592 {
593 public:
594  DECLARE_SERIALIZABLE_CAST(DistributedPartialResultStep3);
596  DistributedPartialResultStep3();
598  virtual ~DistributedPartialResultStep3() {}
599 
606  template <typename algorithmFPType>
607  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
608 
615  template <typename algorithmFPType>
616  DAAL_EXPORT services::Status setPartialResultStorage(data_management::DataCollection *qCollection);
617 
623  ResultPtr get(DistributedPartialResultStep3Id id) const;
624 
630  void set(DistributedPartialResultStep3Id id, const ResultPtr &value);
631 
638  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
639 
640 
646  virtual services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
647 
648 protected:
650  template<typename Archive, bool onDeserialize>
651  services::Status serialImpl(Archive *arch)
652  {
653  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
654  }
655 };
656 typedef services::SharedPtr<DistributedPartialResultStep3> DistributedPartialResultStep3Ptr;
657 
662 struct DAAL_EXPORT Parameter : public daal::algorithms::Parameter
663 {
667  Parameter() {}
668 };
671 } // namespace interface1
672 using interface1::Input;
673 using interface1::DistributedStep2Input;
674 using interface1::DistributedStep3Input;
675 using interface1::OnlinePartialResult;
676 using interface1::OnlinePartialResultPtr;
677 using interface1::Result;
678 using interface1::ResultPtr;
679 using interface1::DistributedPartialResult;
680 using interface1::DistributedPartialResultPtr;
681 using interface1::DistributedPartialResultStep3;
682 using interface1::DistributedPartialResultStep3Ptr;
683 using interface1::Parameter;
684 
685 } // namespace daal::algorithms::qr
686 } // namespace daal::algorithms
687 } // namespace daal
688 #endif
daal::algorithms::qr::interface1::Input::~Input
virtual ~Input()
Definition: qr_types.h:196
daal::algorithms::qr::DistributedPartialResultCollectionId
DistributedPartialResultCollectionId
Definition: qr_types.h:125
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::services::interface1::Status
Class that holds the results of API calls. In case of API routine failure it contains the list of err...
Definition: error_handling.h:491
daal
Definition: algorithm_base_common.h:57
daal::algorithms::qr::outputOfStep1ForStep2
Definition: qr_types.h:115
daal::algorithms::interface1::Result
Base class to represent final results of the computation. Algorithm-specific final results are repres...
Definition: algorithm_types.h:331
daal::algorithms::qr::interface1::Parameter
Parameters for the QR decomposition compute method.
Definition: qr_types.h:662
daal::algorithms::qr::interface1::Result
Provides methods to access final results obtained with the compute() method of the QR decomposition a...
Definition: qr_types.h:418
daal::algorithms::qr::interface1::DistributedPartialResultStep3::~DistributedPartialResultStep3
virtual ~DistributedPartialResultStep3()
Definition: qr_types.h:598
daal::algorithms::qr::finalResultFromStep2Master
Definition: qr_types.h:138
daal::data_management::interface1::DataCollection
Class that provides functionality of Collection container for objects derived from SerializationIface...
Definition: data_collection.h:71
daal::algorithms::qr::matrixR
Definition: qr_types.h:102
daal::algorithms::qr::FinalizeOnLocalInputId
FinalizeOnLocalInputId
Definition: qr_types.h:167
daal::algorithms::qr::defaultDense
Definition: qr_types.h:82
daal::algorithms::qr::interface1::DistributedStep3Input
Input objects for the third step of the QR decomposition algorithm in the distributed processing mode...
Definition: qr_types.h:283
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::interface1::PartialResult
Base class to represent partial results of the computation. Algorithm-specific partial results are re...
Definition: algorithm_types.h:253
daal::algorithms::qr::inputOfStep3FromStep1
Definition: qr_types.h:169
daal_defines.h
daal::algorithms::qr::outputOfStep2ForStep3
Definition: qr_types.h:127
daal::algorithms::interface1::Parameter
Base class to represent computation parameters. Algorithm-specific parameters are represented as deri...
Definition: algorithm_types.h:86
daal::services::interface1::SharedPtr
Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr object...
Definition: daal_shared_ptr.h:187
daal::algorithms::qr::InputId
InputId
Definition: qr_types.h:89
daal::algorithms::qr::interface1::Parameter::Parameter
Parameter()
Definition: qr_types.h:667
daal::algorithms::qr::interface1::DistributedPartialResult
Provides methods to access partial results obtained with the compute() method of the second step of t...
Definition: qr_types.h:499
daal::algorithms::qr::data
Definition: qr_types.h:91
daal::algorithms::qr::interface1::OnlinePartialResult::~OnlinePartialResult
virtual ~OnlinePartialResult()
Definition: qr_types.h:328
daal::algorithms::qr::Method
Method
Definition: qr_types.h:80
daal::algorithms::qr::PartialResultId
PartialResultId
Definition: qr_types.h:111
daal::algorithms::qr::DistributedPartialResultStep3Id
DistributedPartialResultStep3Id
Definition: qr_types.h:146
daal::algorithms::math::abs::value
Definition: abs_types.h:112
daal::algorithms::qr::interface1::DistributedStep2Input
Input objects for the second step of the QR decomposition algorithm in the distributed processing mod...
Definition: qr_types.h:228
daal::algorithms::qr::inputOfStep3FromStep2
Definition: qr_types.h:171
daal::algorithms::qr::matrixQ
Definition: qr_types.h:101
daal::algorithms::qr::finalResultFromStep3
Definition: qr_types.h:148
daal::algorithms::qr::interface1::DistributedPartialResult::~DistributedPartialResult
virtual ~DistributedPartialResult()
Definition: qr_types.h:506
daal::algorithms::qr::ResultId
ResultId
Definition: qr_types.h:99
daal::algorithms::qr::DistributedPartialResultId
DistributedPartialResultId
Definition: qr_types.h:136
daal::algorithms::qr::interface1::DistributedPartialResultStep3
Provides methods to access partial results obtained with the compute() method of the third step of th...
Definition: qr_types.h:591
daal::algorithms::qr::MasterInputId
MasterInputId
Definition: qr_types.h:156
daal::algorithms::interface1::Input
Base class to represent computation input arguments. Algorithm-specific input arguments are represent...
Definition: algorithm_types.h:217
daal::algorithms::qr::inputOfStep2FromStep1
Definition: qr_types.h:158
daal::algorithms::qr::outputOfStep1ForStep3
Definition: qr_types.h:113
daal::algorithms::qr::interface1::Result::~Result
virtual ~Result()
Definition: qr_types.h:425

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