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

svd_types.h
1 /* file: svd_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 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 the SVD common types.
19 //--
20 */
21 
22 #ifndef __SVD_TYPES_H__
23 #define __SVD_TYPES_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/numeric_table.h"
27 #include "data_management/data/homogen_numeric_table.h"
28 #include "services/daal_defines.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
41 namespace svd
42 {
47 enum Method
48 {
49  defaultDense = 0
50 };
51 
56 enum SVDResultFormat
57 {
58  notRequired,
59  requiredInPackedForm
60 };
61 
66 enum InputId
67 {
68  data,
69  lastInputId = data
70 };
71 
76 enum ResultId
77 {
78  singularValues,
79  leftSingularMatrix,
80  rightSingularMatrix,
81  lastResultId = rightSingularMatrix
82 };
83 
89 enum PartialResultId
90 {
91  outputOfStep1ForStep3,
93  outputOfStep1ForStep2,
95  lastPartialResultId = outputOfStep1ForStep2
96 };
97 
103 enum DistributedPartialResultCollectionId
104 {
105  outputOfStep2ForStep3,
106  lastDistributedPartialResultCollectionId = outputOfStep2ForStep3
107 };
108 
114 enum DistributedPartialResultId
115 {
116  finalResultFromStep2Master = lastDistributedPartialResultCollectionId + 1,
117  lastDistributedPartialResultId = finalResultFromStep2Master
118 };
119 
125 enum DistributedPartialResultStep3Id
126 {
127  finalResultFromStep3,
128  lastDistributedPartialResultStep3Id = finalResultFromStep3
129 };
130 
135 enum MasterInputId
136 {
137  inputOfStep2FromStep1,
138  lastMasterInputId = inputOfStep2FromStep1
139 };
140 
145 enum FinalizeOnLocalInputId
146 {
147  inputOfStep3FromStep1,
148  inputOfStep3FromStep2,
149  lastFinalizeOnLocalInputId = inputOfStep3FromStep2
150 };
151 
155 namespace interface1
156 {
161 struct DAAL_EXPORT Parameter : public daal::algorithms::Parameter
162 {
168  Parameter(SVDResultFormat _leftSingularMatrix = requiredInPackedForm,
169  SVDResultFormat _rightSingularMatrix = requiredInPackedForm) :
170  leftSingularMatrix(_leftSingularMatrix), rightSingularMatrix(_rightSingularMatrix) {}
171 
172  SVDResultFormat leftSingularMatrix;
173  SVDResultFormat rightSingularMatrix;
174 };
175 
181 class DAAL_EXPORT Input : public daal::algorithms::Input
182 {
183 public:
185  Input();
187  Input(const Input& other);
189  virtual ~Input() {}
190 
196  data_management::NumericTablePtr get(InputId id) const;
197 
203  void set(InputId id, const data_management::NumericTablePtr &value);
204 
205  services::Status getNumberOfColumns(size_t *nFeatures) const;
206 
207  services::Status getNumberOfRows(size_t *nRows) const;
208 
215  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
216 
217 };
218 
223 class DAAL_EXPORT DistributedStep2Input : public daal::algorithms::Input
224 {
225 public:
227  DistributedStep2Input();
228 
230  DistributedStep2Input(const DistributedStep2Input& other);
231 
237  void set(MasterInputId id, const data_management::KeyValueDataCollectionPtr &ptr);
238 
244  data_management::KeyValueDataCollectionPtr get(MasterInputId id) const;
245 
252  void add(MasterInputId id, size_t key, const data_management::DataCollectionPtr &value);
253 
254  size_t getNBlocks();
255 
262  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
263 
264 protected:
269  services::Status getNumberOfColumns(size_t& nCols) const;
270 };
271 
276 class DAAL_EXPORT DistributedStep3Input : public daal::algorithms::Input
277 {
278 public:
280  DistributedStep3Input();
281 
283  DistributedStep3Input(const DistributedStep3Input& other);
284 
290  data_management::DataCollectionPtr get(FinalizeOnLocalInputId id) const;
291 
297  void set(FinalizeOnLocalInputId id, const data_management::DataCollectionPtr &value);
298 
299  services::Status getSizes(size_t &nFeatures, size_t &nVectors) const;
300 
307  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
308 
309 };
310 
316 class DAAL_EXPORT OnlinePartialResult : public daal::algorithms::PartialResult
317 {
318 public:
319  DECLARE_SERIALIZABLE_CAST(OnlinePartialResult);
321  OnlinePartialResult();
323  virtual ~OnlinePartialResult() {}
324 
332  template <typename algorithmFPType>
333  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
334 
342  template <typename algorithmFPType>
343  DAAL_EXPORT services::Status initialize(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
344 
352  template <typename algorithmFPType>
353  DAAL_EXPORT services::Status addPartialResultStorage(size_t m, size_t n, Parameter &par);
354 
360  data_management::DataCollectionPtr get(PartialResultId id) const;
361 
367  void set(PartialResultId id, const data_management::DataCollectionPtr &value);
368 
375  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
376 
377  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
378 
379  size_t getNumberOfColumns() const;
380 
381  size_t getNumberOfRows() const;
382 
383 protected:
385  template<typename Archive, bool onDeserialize>
386  services::Status serialImpl(Archive *arch)
387  {
388  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
389  }
390  services::Status checkImpl(const daal::algorithms::Parameter *parameter, int method, size_t nFeatures, size_t nVectors) const;
391 };
392 typedef services::SharedPtr<OnlinePartialResult> OnlinePartialResultPtr;
393 
399 class DAAL_EXPORT Result : public daal::algorithms::Result
400 {
401 public:
402  DECLARE_SERIALIZABLE_CAST(Result);
404  Result();
406  virtual ~Result() {}
407 
413  data_management::NumericTablePtr get(ResultId id) const;
414 
422  template <typename algorithmFPType>
423  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
424 
432  template <typename algorithmFPType>
433  DAAL_EXPORT services::Status allocate(const daal::algorithms::PartialResult *partialResult, daal::algorithms::Parameter *parameter, const int method);
434 
440  void set(ResultId id, const data_management::NumericTablePtr &value);
441 
449  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
450 
457  services::Status check(const daal::algorithms::PartialResult *pres, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
458 
466  template <typename algorithmFPType>
467  DAAL_EXPORT services::Status allocateImpl(size_t m, size_t n);
468 
469 protected:
471  template<typename Archive, bool onDeserialize>
472  services::Status serialImpl(Archive *arch)
473  {
474  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
475  }
476 };
477 typedef services::SharedPtr<Result> ResultPtr;
478 
484 class DAAL_EXPORT DistributedPartialResult : public daal::algorithms::PartialResult
485 {
486 public:
487  DECLARE_SERIALIZABLE_CAST(DistributedPartialResult);
489  DistributedPartialResult();
491  virtual ~DistributedPartialResult() {}
492 
497  template <typename algorithmFPType>
498  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
499 
510  template <typename algorithmFPType>
511  DAAL_EXPORT services::Status setPartialResultStorage(data_management::KeyValueDataCollection *inCollection, size_t &nBlocks);
512 
520  data_management::KeyValueDataCollectionPtr get(DistributedPartialResultCollectionId id) const;
521 
528  data_management::DataCollectionPtr get(DistributedPartialResultCollectionId id, size_t idx) const;
529 
535  ResultPtr get(DistributedPartialResultId id) const;
536 
542  void set(DistributedPartialResultCollectionId id, const data_management::KeyValueDataCollectionPtr &value);
543 
549  void set(DistributedPartialResultId id, const ResultPtr &value);
550 
557  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
558 
566  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
567 
568 protected:
570  template<typename Archive, bool onDeserialize>
571  services::Status serialImpl(Archive *arch)
572  {
573  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
574  }
575 };
576 typedef services::SharedPtr<DistributedPartialResult> DistributedPartialResultPtr;
577 
583 class DAAL_EXPORT DistributedPartialResultStep3 : public daal::algorithms::PartialResult
584 {
585 public:
586  DECLARE_SERIALIZABLE_CAST(DistributedPartialResultStep3);
588  DistributedPartialResultStep3();
590  virtual ~DistributedPartialResultStep3() {}
591 
599  template <typename algorithmFPType>
600  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
601 
607  template <typename algorithmFPType>
608  DAAL_EXPORT services::Status setPartialResultStorage(data_management::DataCollection *qCollection);
609 
615  ResultPtr get(DistributedPartialResultStep3Id id) const;
616 
622  void set(DistributedPartialResultStep3Id id, const ResultPtr &value);
623 
631  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
632 
633 
640  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
641 
642 protected:
644  template<typename Archive, bool onDeserialize>
645  services::Status serialImpl(Archive *arch)
646  {
647  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
648  }
649 };
650 typedef services::SharedPtr<DistributedPartialResultStep3> DistributedPartialResultStep3Ptr;
652 } // namespace interface1
653 using interface1::Parameter;
654 using interface1::Input;
655 using interface1::DistributedStep2Input;
656 using interface1::DistributedStep3Input;
657 using interface1::OnlinePartialResult;
658 using interface1::OnlinePartialResultPtr;
659 using interface1::Result;
660 using interface1::ResultPtr;
661 using interface1::DistributedPartialResult;
662 using interface1::DistributedPartialResultPtr;
663 using interface1::DistributedPartialResultStep3;
664 using interface1::DistributedPartialResultStep3Ptr;
665 
666 } // namespace daal::algorithms::svd
667 } // namespace daal::algorithms
668 } // namespace daal
669 #endif
daal::algorithms::svd::DistributedPartialResultId
DistributedPartialResultId
Available types of partial results obtained in the second step of the SVD algorithm in the distribute...
Definition: svd_types.h:114
daal::algorithms::svd::leftSingularMatrix
Definition: svd_types.h:79
daal::algorithms::svd::interface1::Parameter
Parameters for the computation method of the SVD algorithm.
Definition: svd_types.h:161
daal
Definition: algorithm_base_common.h:31
daal::algorithms::svd::interface1::OnlinePartialResult::~OnlinePartialResult
virtual ~OnlinePartialResult()
Definition: svd_types.h:323
daal::algorithms::svd::SVDResultFormat
SVDResultFormat
Definition: svd_types.h:56
daal::algorithms::svd::inputOfStep3FromStep2
Definition: svd_types.h:148
daal::algorithms::svd::Method
Method
Definition: svd_types.h:47
daal::algorithms::svd::singularValues
Definition: svd_types.h:78
daal::algorithms::svd::inputOfStep2FromStep1
Definition: svd_types.h:137
daal::algorithms::svd::inputOfStep3FromStep1
Definition: svd_types.h:147
daal::algorithms::svd::interface1::Parameter::rightSingularMatrix
SVDResultFormat rightSingularMatrix
Definition: svd_types.h:173
daal::algorithms::svd::data
Definition: svd_types.h:68
daal::algorithms::svd::interface1::DistributedStep2Input
Input objects for the second step of the SVD algorithm in the distributed processing mode ...
Definition: svd_types.h:223
daal::algorithms::svd::InputId
InputId
Available types of input objects for the SVD algorithm.
Definition: svd_types.h:66
daal::algorithms::svd::interface1::Result
Provides methods to access final results obtained with the compute() method of the SVD algorithm in t...
Definition: svd_types.h:399
daal::algorithms::svd::FinalizeOnLocalInputId
FinalizeOnLocalInputId
Partial results from previous steps in the distributed processing mode, required by the third step...
Definition: svd_types.h:145
daal::algorithms::svd::interface1::Parameter::leftSingularMatrix
SVDResultFormat leftSingularMatrix
Definition: svd_types.h:172
daal_defines.h
daal::algorithms::svd::interface1::DistributedPartialResultStep3
Provides methods to access partial results obtained with the compute() method of the SVD algorithm in...
Definition: svd_types.h:583
daal::algorithms::svd::ResultId
ResultId
Available types of results of the SVD algorithm.
Definition: svd_types.h:76
daal::algorithms::svd::interface1::DistributedPartialResult::~DistributedPartialResult
virtual ~DistributedPartialResult()
Definition: svd_types.h:491
daal::algorithms::svd::interface1::Parameter::Parameter
Parameter(SVDResultFormat _leftSingularMatrix=requiredInPackedForm, SVDResultFormat _rightSingularMatrix=requiredInPackedForm)
Definition: svd_types.h:168
daal::algorithms::svd::requiredInPackedForm
Definition: svd_types.h:59
daal::algorithms::svd::interface1::Input
Input objects for the SVD algorithm in the batch processing and online processing modes...
Definition: svd_types.h:181
daal::algorithms::svd::DistributedPartialResultCollectionId
DistributedPartialResultCollectionId
Available types of partial results obtained in the second step of the SVD algorithm in the distribute...
Definition: svd_types.h:103
daal::algorithms::svd::outputOfStep2ForStep3
Definition: svd_types.h:105
daal::algorithms::svd::finalResultFromStep2Master
Definition: svd_types.h:116
daal::algorithms::svd::PartialResultId
PartialResultId
Available types of partial results of the SVD algorithm obtained in the online processing mode and in...
Definition: svd_types.h:89
daal::algorithms::svd::interface1::Result::~Result
virtual ~Result()
Definition: svd_types.h:406
daal::algorithms::svd::DistributedPartialResultStep3Id
DistributedPartialResultStep3Id
Available types of partial results obtained in the third step of the SVD algorithm in the distributed...
Definition: svd_types.h:125
daal::algorithms::svd::rightSingularMatrix
Definition: svd_types.h:80
daal::algorithms::svd::interface1::DistributedStep3Input
Input objects for the third step of the SVD algorithm in the distributed processing mode ...
Definition: svd_types.h:276
daal::algorithms::math::abs::value
Definition: abs_types.h:86
daal::algorithms::svd::finalResultFromStep3
Definition: svd_types.h:127
daal::algorithms::svd::interface1::DistributedPartialResultStep3::~DistributedPartialResultStep3
virtual ~DistributedPartialResultStep3()
Definition: svd_types.h:590
daal::algorithms::svd::interface1::OnlinePartialResult
Provides methods to access partial results obtained with the compute() method of the SVD algorithm in...
Definition: svd_types.h:316
daal::algorithms::svd::interface1::Input::~Input
virtual ~Input()
Definition: svd_types.h:189
daal::algorithms::svd::MasterInputId
MasterInputId
Partial results from previous steps in the distributed processing mode, required by the second step...
Definition: svd_types.h:135
daal::algorithms::svd::interface1::DistributedPartialResult
Provides methods to access partial results obtained with the compute() method of the SVD algorithm in...
Definition: svd_types.h:484
daal::algorithms::svd::outputOfStep1ForStep2
Definition: svd_types.h:93
daal::algorithms::svd::outputOfStep1ForStep3
Definition: svd_types.h:91
daal::algorithms::svd::defaultDense
Definition: svd_types.h:49
daal::algorithms::svd::notRequired
Definition: svd_types.h:58

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