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

qr_types.h
1 /* file: qr_types.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 // Definition of QR common types.
19 //--
20 */
21 
22 
23 #ifndef __QR_TYPES_H__
24 #define __QR_TYPES_H__
25 
26 #include "algorithms/algorithm.h"
27 #include "data_management/data/numeric_table.h"
28 #include "data_management/data/homogen_numeric_table.h"
29 #include "services/daal_defines.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
48 namespace qr
49 {
54 enum Method
55 {
56  defaultDense = 0
57 };
58 
63 enum InputId
64 {
65  data,
66  lastInputId = data
67 };
68 
73 enum ResultId
74 {
75  matrixQ,
76  matrixR,
77  lastResultId = matrixR
78 };
79 
85 enum PartialResultId
86 {
87  outputOfStep1ForStep3,
89  outputOfStep1ForStep2,
91  lastPartialResultId = outputOfStep1ForStep2
92 };
93 
99 enum DistributedPartialResultCollectionId
100 {
101  outputOfStep2ForStep3,
103  lastDistributedPartialResultCollectionId = outputOfStep2ForStep3
104 };
105 
110 enum DistributedPartialResultId
111 {
112  finalResultFromStep2Master = lastDistributedPartialResultCollectionId + 1,
113  lastDistributedPartialResultId = finalResultFromStep2Master
114 };
115 
120 enum DistributedPartialResultStep3Id
121 {
122  finalResultFromStep3,
123  lastDistributedPartialResultStep3Id = finalResultFromStep3
124 };
125 
130 enum MasterInputId
131 {
132  inputOfStep2FromStep1,
134  lastMasterInputId = inputOfStep2FromStep1
135 };
136 
141 enum FinalizeOnLocalInputId
142 {
143  inputOfStep3FromStep1,
145  inputOfStep3FromStep2,
147  lastFinalizeOnLocalInputId = inputOfStep3FromStep2
148 };
149 
153 namespace interface1
154 {
160 class DAAL_EXPORT Input : public daal::algorithms::Input
161 {
162 public:
164  Input();
165 
167  Input(const Input& other);
168 
170  virtual ~Input() {}
171 
177  data_management::NumericTablePtr get(InputId id) const;
178 
184  void set(InputId id, const data_management::NumericTablePtr &value);
185 
186  services::Status getNumberOfColumns(size_t *nFeatures) const;
187 
188  services::Status getNumberOfRows(size_t *nRows) const;
189 
195  virtual services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
196 };
197 
202 class DAAL_EXPORT DistributedStep2Input : public daal::algorithms::Input
203 {
204 public:
206  DistributedStep2Input();
207 
209  DistributedStep2Input(const DistributedStep2Input& other);
210 
215  services::Status getNumberOfColumns(size_t *nFeatures) const;
216 
222  void set(MasterInputId id, const data_management::KeyValueDataCollectionPtr &ptr);
223 
229  data_management::KeyValueDataCollectionPtr get(MasterInputId id) const;
230 
237  void add(MasterInputId id, size_t key, const data_management::DataCollectionPtr &value);
238 
243  size_t getNBlocks();
244 
250  virtual services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
251 };
252 
257 class DAAL_EXPORT DistributedStep3Input : public daal::algorithms::Input
258 {
259 public:
261  DistributedStep3Input();
262 
264  DistributedStep3Input(const DistributedStep3Input& other);
265 
271  data_management::DataCollectionPtr get(FinalizeOnLocalInputId id) const;
272 
278  void set(FinalizeOnLocalInputId id, const data_management::DataCollectionPtr &value);
279 
280  services::Status getSizes(size_t &nFeatures, size_t &nVectors) const;
281 
287  virtual services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
288 };
289 
295 class DAAL_EXPORT OnlinePartialResult : public daal::algorithms::PartialResult
296 {
297 public:
298  DECLARE_SERIALIZABLE_CAST(OnlinePartialResult);
300  OnlinePartialResult();
302  virtual ~OnlinePartialResult() {}
303 
310  template <typename algorithmFPType>
311  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
312 
320  template <typename algorithmFPType>
321  DAAL_EXPORT services::Status initialize(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
322 
329  template <typename algorithmFPType>
330  DAAL_EXPORT services::Status addPartialResultStorage(size_t m, size_t n);
331 
337  data_management::DataCollectionPtr get(PartialResultId id) const;
338 
344  void set(PartialResultId id, const data_management::DataCollectionPtr &value);
345 
352  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
353 
359  virtual services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
360 
366  size_t getNumberOfColumns() const;
367 
372  size_t getNumberOfRows() const;
373 
374 protected:
376  template<typename Archive, bool onDeserialize>
377  services::Status serialImpl(Archive *arch)
378  {
379  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
380  }
381 
382  services::Status checkImpl(const daal::algorithms::Parameter *parameter, int method, size_t nFeatures, size_t nVectors) const;
383 };
384 typedef services::SharedPtr<OnlinePartialResult> OnlinePartialResultPtr;
385 
392 class DAAL_EXPORT Result : public daal::algorithms::Result
393 {
394 public:
395  DECLARE_SERIALIZABLE_CAST(Result);
397  Result();
399  virtual ~Result() {}
400 
406  data_management::NumericTablePtr get(ResultId id) const;
407 
414  template <typename algorithmFPType>
415  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
416 
423  template <typename algorithmFPType>
424  DAAL_EXPORT services::Status allocate(const daal::algorithms::PartialResult *partialResult, daal::algorithms::Parameter *parameter, const int method);
425 
431  void set(ResultId id, const data_management::NumericTablePtr &value);
432 
439  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
440 
447  virtual services::Status check(const daal::algorithms::PartialResult *pres, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
448 
455  template <typename algorithmFPType>
456  DAAL_EXPORT services::Status allocateImpl(size_t m, size_t n);
457 
458 protected:
460  template<typename Archive, bool onDeserialize>
461  services::Status serialImpl(Archive *arch)
462  {
463  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
464  }
465 };
466 typedef services::SharedPtr<Result> ResultPtr;
467 
473 class DAAL_EXPORT DistributedPartialResult : public daal::algorithms::PartialResult
474 {
475 public:
476  DECLARE_SERIALIZABLE_CAST(DistributedPartialResult);
478  DistributedPartialResult();
480  virtual ~DistributedPartialResult() {}
481 
488  template <typename algorithmFPType>
489  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
490 
501  template <typename algorithmFPType>
502  DAAL_EXPORT services::Status setPartialResultStorage(data_management::KeyValueDataCollection *inCollection, size_t &nBlocks);
503 
511  data_management::KeyValueDataCollectionPtr get(DistributedPartialResultCollectionId id) const;
512 
518  ResultPtr get(DistributedPartialResultId id) const;
519 
525  void set(DistributedPartialResultCollectionId id, const data_management::KeyValueDataCollectionPtr &value);
526 
532  void set(DistributedPartialResultId id, const ResultPtr &value);
533 
534 
540  virtual services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
541 
548  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
549 
550 protected:
552  template<typename Archive, bool onDeserialize>
553  services::Status serialImpl(Archive *arch)
554  {
555  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
556  }
557 };
558 typedef services::SharedPtr<DistributedPartialResult>DistributedPartialResultPtr;
559 
565 class DAAL_EXPORT DistributedPartialResultStep3 : public daal::algorithms::PartialResult
566 {
567 public:
568  DECLARE_SERIALIZABLE_CAST(DistributedPartialResultStep3);
570  DistributedPartialResultStep3();
572  virtual ~DistributedPartialResultStep3() {}
573 
580  template <typename algorithmFPType>
581  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
582 
589  template <typename algorithmFPType>
590  DAAL_EXPORT services::Status setPartialResultStorage(data_management::DataCollection *qCollection);
591 
597  ResultPtr get(DistributedPartialResultStep3Id id) const;
598 
604  void set(DistributedPartialResultStep3Id id, const ResultPtr &value);
605 
612  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
613 
614 
620  virtual services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
621 
622 protected:
624  template<typename Archive, bool onDeserialize>
625  services::Status serialImpl(Archive *arch)
626  {
627  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
628  }
629 };
630 typedef services::SharedPtr<DistributedPartialResultStep3> DistributedPartialResultStep3Ptr;
631 
636 struct DAAL_EXPORT Parameter : public daal::algorithms::Parameter
637 {
641  Parameter() {}
642 };
645 } // namespace interface1
646 using interface1::Input;
647 using interface1::DistributedStep2Input;
648 using interface1::DistributedStep3Input;
649 using interface1::OnlinePartialResult;
650 using interface1::OnlinePartialResultPtr;
651 using interface1::Result;
652 using interface1::ResultPtr;
653 using interface1::DistributedPartialResult;
654 using interface1::DistributedPartialResultPtr;
655 using interface1::DistributedPartialResultStep3;
656 using interface1::DistributedPartialResultStep3Ptr;
657 using interface1::Parameter;
658 
659 } // namespace daal::algorithms::qr
660 } // namespace daal::algorithms
661 } // namespace daal
662 #endif
daal::algorithms::qr::interface1::Input::~Input
virtual ~Input()
Definition: qr_types.h:170
daal::algorithms::qr::DistributedPartialResultCollectionId
DistributedPartialResultCollectionId
Definition: qr_types.h:99
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
Definition: algorithm_base_common.h:31
daal::algorithms::qr::outputOfStep1ForStep2
Definition: qr_types.h:89
daal::algorithms::interface1::Result
Base class to represent final results of the computation. Algorithm-specific final results are repres...
Definition: algorithm_types.h:307
daal::algorithms::qr::interface1::Parameter
Parameters for the QR decomposition compute method.
Definition: qr_types.h:636
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:392
daal::algorithms::qr::interface1::DistributedPartialResultStep3::~DistributedPartialResultStep3
virtual ~DistributedPartialResultStep3()
Definition: qr_types.h:572
daal::algorithms::qr::finalResultFromStep2Master
Definition: qr_types.h:112
daal::algorithms::qr::matrixR
Definition: qr_types.h:76
daal::algorithms::qr::FinalizeOnLocalInputId
FinalizeOnLocalInputId
Definition: qr_types.h:141
daal::algorithms::qr::defaultDense
Definition: qr_types.h:56
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:257
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:160
daal::algorithms::qr::inputOfStep3FromStep1
Definition: qr_types.h:143
daal_defines.h
daal::algorithms::qr::outputOfStep2ForStep3
Definition: qr_types.h:101
daal::algorithms::interface1::Parameter
Base class to represent computation parameters. Algorithm-specific parameters are represented as deri...
Definition: algorithm_types.h:60
daal::algorithms::qr::InputId
InputId
Definition: qr_types.h:63
daal::algorithms::qr::interface1::Parameter::Parameter
Parameter()
Definition: qr_types.h:641
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:473
daal::algorithms::qr::data
Definition: qr_types.h:65
daal::algorithms::qr::interface1::OnlinePartialResult::~OnlinePartialResult
virtual ~OnlinePartialResult()
Definition: qr_types.h:302
daal::algorithms::qr::Method
Method
Definition: qr_types.h:54
daal::algorithms::qr::PartialResultId
PartialResultId
Definition: qr_types.h:85
daal::algorithms::qr::DistributedPartialResultStep3Id
DistributedPartialResultStep3Id
Definition: qr_types.h:120
daal::algorithms::math::abs::value
Definition: abs_types.h:86
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:202
daal::algorithms::qr::inputOfStep3FromStep2
Definition: qr_types.h:145
daal::algorithms::qr::matrixQ
Definition: qr_types.h:75
daal::algorithms::qr::finalResultFromStep3
Definition: qr_types.h:122
daal::algorithms::qr::interface1::DistributedPartialResult::~DistributedPartialResult
virtual ~DistributedPartialResult()
Definition: qr_types.h:480
daal::algorithms::qr::ResultId
ResultId
Definition: qr_types.h:73
daal::algorithms::qr::DistributedPartialResultId
DistributedPartialResultId
Definition: qr_types.h:110
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:565
daal::algorithms::qr::MasterInputId
MasterInputId
Definition: qr_types.h:130
daal::algorithms::interface1::Input
Base class to represent computation input arguments. Algorithm-specific input arguments are represent...
Definition: algorithm_types.h:191
daal::algorithms::qr::inputOfStep2FromStep1
Definition: qr_types.h:132
daal::algorithms::qr::outputOfStep1ForStep3
Definition: qr_types.h:87
daal::algorithms::qr::interface1::Result::~Result
virtual ~Result()
Definition: qr_types.h:399

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