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

svd_batch.h
1 /* file: svd_batch.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 SVD algorithm in the batch processing mode
19 //--
20 */
21 
22 #ifndef __SVD_BATCH_H__
23 #define __SVD_BATCH_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/numeric_table.h"
27 #include "services/daal_defines.h"
28 #include "algorithms/svd/svd_types.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 namespace svd
35 {
36 
37 namespace interface1
38 {
52 template<typename algorithmFPType, Method method, CpuType cpu>
53 class DAAL_EXPORT BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
54 {
55 public:
61  BatchContainer(daal::services::Environment::env *daalEnv);
63  virtual ~BatchContainer();
67  virtual services::Status compute() DAAL_C11_OVERRIDE;
68 };
69 
81 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
82 class DAAL_EXPORT Batch : public daal::algorithms::Analysis<batch>
83 {
84 public:
85  typedef algorithms::svd::Input InputType;
86  typedef algorithms::svd::Parameter ParameterType;
87  typedef algorithms::svd::Result ResultType;
88 
89  InputType input;
90  ParameterType parameter;
92  Batch()
93  {
94  initialize();
95  }
96 
103  Batch(const Batch<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
104  {
105  initialize();
106  }
107 
112  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
113 
118  ResultPtr getResult()
119  {
120  return _result;
121  }
122 
126  services::Status setResult(const ResultPtr& res)
127  {
128  DAAL_CHECK(res, services::ErrorNullResult)
129  _result = res;
130  _res = _result.get();
131  return services::Status();
132  }
133 
139  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
140  {
141  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
142  }
143 
144 protected:
145  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
146  {
147  return new Batch<algorithmFPType, method>(*this);
148  }
149 
150  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
151  {
152  _result.reset(new ResultType());
153  services::Status s = _result->allocate<algorithmFPType>(_in, 0, 0);
154  _res = _result.get();
155  return s;
156  }
157 
158  void initialize()
159  {
160  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
161  _in = &input;
162  _par = &parameter;
163  }
164 
165 private:
166  ResultPtr _result;
167 };
169 } // namespace interface1
170 using interface1::BatchContainer;
171 using interface1::Batch;
172 
173 } // namespace daal::algorithms::svd
174 }
175 } // namespace daal
176 #endif
daal::algorithms::svd::interface1::Batch::input
InputType input
Definition: svd_batch.h:89
daal::algorithms::svd::interface1::Batch
Computes results of the SVD algorithm in the batch processing mode.
Definition: svd_batch.h:82
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::svd::interface1::Batch::parameter
ParameterType parameter
Definition: svd_batch.h:90
daal::algorithms::svd::interface1::Batch::setResult
services::Status setResult(const ResultPtr &res)
Definition: svd_batch.h:126
daal::algorithms::svd::interface1::BatchContainer
Provides methods to run implementations of the SVD algorithm.
Definition: svd_batch.h:53
daal_defines.h
daal::batch
Definition: daal_defines.h:110
daal::algorithms::svd::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: svd_batch.h:139
daal::algorithms::svd::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: svd_batch.h:112
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::svd::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: svd_batch.h:103
daal::algorithms::svd::interface1::Batch::getResult
ResultPtr getResult()
Definition: svd_batch.h:118
daal::services::ErrorNullResult
Definition: error_indexes.h:96

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