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

pca_batch.h
1 /* file: pca_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 PCA algorithm in the batch processing mode
19 //--
20 */
21 
22 #ifndef __PCA_BATCH_H__
23 #define __PCA_BATCH_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/numeric_table.h"
27 #include "services/daal_defines.h"
28 #include "services/daal_memory.h"
29 #include "algorithms/pca/pca_types.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
35 namespace pca
36 {
37 
38 namespace interface3
39 {
46 template<typename algorithmFPType, Method method, CpuType cpu>
47 class DAAL_EXPORT BatchContainer : public AnalysisContainerIface<batch>
48 {};
49 
53 template<typename algorithmFPType, CpuType cpu>
54 class DAAL_EXPORT BatchContainer<algorithmFPType, correlationDense, cpu> : public AnalysisContainerIface<batch>
55 {
56 public:
62  BatchContainer(daal::services::Environment::env *daalEnv);
64  ~BatchContainer();
68  services::Status compute() DAAL_C11_OVERRIDE;
69 };
78 template<typename algorithmFPType, CpuType cpu>
79 class DAAL_EXPORT BatchContainer<algorithmFPType, svdDense, cpu> : public AnalysisContainerIface<batch>
80 {
81 public:
87  BatchContainer(daal::services::Environment::env *daalEnv);
89  ~BatchContainer();
93  services::Status compute() DAAL_C11_OVERRIDE;
94 };
106 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = correlationDense>
107 class DAAL_EXPORT Batch : public Analysis<batch>
108 {
109 public:
110  typedef algorithms::pca::Input InputType;
111  typedef algorithms::pca::BatchParameter<algorithmFPType, method> ParameterType;
112  typedef algorithms::pca::Result ResultType;
113 
115  Batch()
116  {
117  initialize();
118  }
119 
125  Batch(const Batch<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
126  {
127  initialize();
128  }
129 
130  ~Batch() {}
131 
136  virtual int getMethod() const DAAL_C11_OVERRIDE { return method; };
137 
142  services::Status setResult(const ResultPtr& res)
143  {
144  DAAL_CHECK(res, services::ErrorNullResult)
145  _result = res;
146  _res = _result.get();
147  return services::Status();
148  }
149 
154  ResultPtr getResult() { return _result; }
155 
161  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
162  {
163  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
164  }
165 
166  InputType input;
167  BatchParameter<algorithmFPType, method> parameter;
169 protected:
170  ResultPtr _result;
171 
172  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
173  {
174  return new Batch<algorithmFPType, method>(*this);
175  }
176 
177  services::Status allocateResult() DAAL_C11_OVERRIDE
178  {
179  services::Status s = _result->allocate<algorithmFPType>(&input, &parameter, method);
180  _res = _result.get();
181  return s;
182  }
183 
184  void initialize()
185  {
186  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
187  _in = &input;
188  _par = &parameter;
189  _result.reset(new ResultType());
190  }
191 };
192 
194 } // namespace interface3
195 using interface3::BatchContainer;
196 using interface3::Batch;
197 
198 } // namespace pca
199 } // namespace algorithms
200 } // namespace daal
201 #endif
daal::algorithms::pca::interface3::Batch::Batch
Batch()
Definition: pca_batch.h:115
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::pca::interface3::BatchParameter
Class that specifies the parameters of the PCA algorithm in the batch computing mode.
Definition: pca_types.h:676
daal::algorithms::pca::interface3::Batch::input
InputType input
Definition: pca_batch.h:166
daal::algorithms::pca::interface3::Batch::parameter
BatchParameter< algorithmFPType, method > parameter
Definition: pca_batch.h:167
daal::algorithms::pca::interface3::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: pca_batch.h:136
daal_defines.h
daal::algorithms::pca::interface3::BatchContainer
Contains version 3.0 of Intel(R) Data Analytics Acceleration Library (Intel(R) DAAL) interface...
Definition: pca_batch.h:47
daal::batch
Definition: daal_defines.h:110
daal::algorithms::pca::svdDense
Definition: pca_types.h:57
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::pca::interface3::Batch::setResult
services::Status setResult(const ResultPtr &res)
Definition: pca_batch.h:142
daal::algorithms::pca::interface3::Batch::getResult
ResultPtr getResult()
Definition: pca_batch.h:154
daal::algorithms::pca::interface3::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: pca_batch.h:125
daal::algorithms::pca::interface3::Batch
Computes the results of the PCA algorithm.
Definition: pca_batch.h:107
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::pca::interface3::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: pca_batch.h:161
daal::algorithms::pca::correlationDense
Definition: pca_types.h:55

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