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

pca_batch.h
1 /* file: pca_batch.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 // 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 interface2
39 {
48 template<typename algorithmFPType, Method method, CpuType cpu>
49 class DAAL_EXPORT BatchContainer : public AnalysisContainerIface<batch>
50 {};
51 
55 template<typename algorithmFPType, CpuType cpu>
56 class DAAL_EXPORT BatchContainer<algorithmFPType, correlationDense, cpu> : public AnalysisContainerIface<batch>
57 {
58 public:
64  BatchContainer(daal::services::Environment::env *daalEnv);
66  ~BatchContainer();
70  services::Status compute() DAAL_C11_OVERRIDE;
71 };
72 
76 template<typename algorithmFPType, CpuType cpu>
77 class DAAL_EXPORT BatchContainer<algorithmFPType, svdDense, cpu> : public AnalysisContainerIface<batch>
78 {
79 public:
85  BatchContainer(daal::services::Environment::env *daalEnv);
87  ~BatchContainer();
91  services::Status compute() DAAL_C11_OVERRIDE;
92 };
93 
105 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = correlationDense>
106 class DAAL_EXPORT Batch : public Analysis<batch>
107 {
108 public:
109  typedef algorithms::pca::Input InputType;
110  typedef algorithms::pca::BatchParameter<algorithmFPType, method> ParameterType;
111  typedef algorithms::pca::Result ResultType;
112 
114  Batch()
115  {
116  initialize();
117  }
118 
124  Batch(const Batch<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
125  {
126  initialize();
127  }
128 
129  ~Batch() {}
130 
135  virtual int getMethod() const DAAL_C11_OVERRIDE { return method; };
136 
141  services::Status setResult(const ResultPtr& res)
142  {
143  DAAL_CHECK(res, services::ErrorNullResult)
144  _result = res;
145  _res = _result.get();
146  return services::Status();
147  }
148 
153  ResultPtr getResult() { return _result; }
154 
160  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
161  {
162  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
163  }
164 
165  InputType input;
166  BatchParameter<algorithmFPType, method> parameter;
168 protected:
169  ResultPtr _result;
170 
171  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
172  {
173  return new Batch<algorithmFPType, method>(*this);
174  }
175 
176  services::Status allocateResult() DAAL_C11_OVERRIDE
177  {
178  services::Status s = _result->allocate<algorithmFPType>(&input, &parameter, method);
179  _res = _result.get();
180  return s;
181  }
182 
183  void initialize()
184  {
185  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
186  _in = &input;
187  _par = &parameter;
188  _result.reset(new ResultType());
189  }
190 };
192 } // namespace interface1
193 using interface2::BatchContainer;
194 using interface2::Batch;
195 
196 }
197 }
198 }
199 #endif
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::interface2::Batch::getResult
ResultPtr getResult()
Definition: pca_batch.h:153
daal_defines.h
daal::batch
Definition: daal_defines.h:106
daal::algorithms::pca::interface2::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: pca_batch.h:124
daal::algorithms::pca::interface2::BatchContainer
Class containing methods to compute the results of the PCA algorithm.
Definition: pca_batch.h:49
daal::algorithms::pca::svdDense
Definition: pca_types.h:57
daal::algorithms::pca::interface2::Batch::input
InputType input
Definition: pca_batch.h:165
daal::algorithms::pca::interface2::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: pca_batch.h:160
daal::algorithms::pca::interface2::Batch::setResult
services::Status setResult(const ResultPtr &res)
Definition: pca_batch.h:141
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::interface2::Batch::Batch
Batch()
Definition: pca_batch.h:114
daal::algorithms::pca::interface2::Batch
Computes the results of the PCA algorithm.
Definition: pca_batch.h:106
daal::algorithms::pca::interface2::Batch::parameter
BatchParameter< algorithmFPType, method > parameter
Definition: pca_batch.h:166
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::pca::interface2::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: pca_batch.h:135
daal::algorithms::pca::interface2::BatchParameter
Class that specifies the parameters of the PCA algorithm in the batch computing mode.
Definition: pca_types.h:673
daal::algorithms::pca::correlationDense
Definition: pca_types.h:55

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