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

pca_transform_batch.h
1 /* file: pca_transform_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 transformation algorithm in the
19 // batch processing mode
20 //--
21 */
22 
23 #ifndef __PCA_TRANSFORM_BATCH_H__
24 #define __PCA_TRANSFORM_BATCH_H__
25 
26 #include "algorithms/algorithm.h"
27 #include "services/daal_defines.h"
28 #include "algorithms/pca/transform/pca_transform_types.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 namespace pca
35 {
36 namespace transform
37 {
38 namespace interface1
39 {
53 template<typename algorithmFPType, Method method, CpuType cpu>
54 class DAAL_EXPORT BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
55 {
56 public:
62  BatchContainer(daal::services::Environment::env *daalEnv);
64  virtual ~BatchContainer();
68  virtual services::Status compute() DAAL_C11_OVERRIDE;
69 };
70 
82 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
83 class DAAL_EXPORT Batch : public daal::algorithms::Analysis<batch>
84 {
85 public:
86  typedef algorithms::pca::transform::Input InputType;
87  typedef algorithms::pca::transform::Parameter ParameterType;
88  typedef algorithms::pca::transform::Result ResultType;
89 
90  InputType input;
91  ParameterType parameter;
97  Batch(size_t nComponents = 0): parameter(nComponents)
98  {
99  initialize();
100  }
101 
108  Batch(const Batch<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
109  {
110  initialize();
111  }
112 
117  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
118 
123  ResultPtr getResult()
124  {
125  return _result;
126  }
127 
132  services::Status setResult(const ResultPtr& res)
133  {
134  DAAL_CHECK(res, services::ErrorNullResult)
135  _result = res;
136  _res = _result.get();
137  return services::Status();
138  }
139 
145  services::SharedPtr<daal::algorithms::pca::transform::interface1::Batch<algorithmFPType, method> > clone() const
146  {
147  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
148  }
149 
150 protected:
151  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
152  {
153  return new Batch<algorithmFPType, method>(*this);
154  }
155 
156  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
157  {
158  _result.reset(new ResultType());
159  services::Status s = _result->allocate<algorithmFPType>(&input, &parameter, 0);
160  _res = _result.get();
161  return s;
162  }
163 
164  void initialize()
165  {
166  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
167  _in = &input;
168  _par = &parameter;
169  }
170 
171 private:
172  ResultPtr _result;
173 };
175 } // namespace interface1
176 using interface1::BatchContainer;
177 using interface1::Batch;
178 
179 } // namespace transform
180 } // namespace pca
181 } // namespace algorithms
182 } // namespace daal
183 #endif
daal::algorithms::pca::transform::interface1::Batch::input
InputType input
Definition: pca_transform_batch.h:90
daal::algorithms::pca::transform::interface1::Batch::clone
services::SharedPtr< daal::algorithms::pca::transform::interface1::Batch< algorithmFPType, method > > clone() const
Definition: pca_transform_batch.h:145
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::transform::interface1::Batch::setResult
services::Status setResult(const ResultPtr &res)
Definition: pca_transform_batch.h:132
daal::algorithms::pca::transform::interface1::BatchContainer
Provides methods to run implementations of the PCA transformation algorithm in the batch processing m...
Definition: pca_transform_batch.h:54
daal::algorithms::pca::transform::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: pca_transform_batch.h:108
daal_defines.h
daal::batch
Definition: daal_defines.h:106
daal::algorithms::pca::transform::interface1::Batch::Batch
Batch(size_t nComponents=0)
Definition: pca_transform_batch.h:97
daal::algorithms::pca::transform::interface1::Batch::getResult
ResultPtr getResult()
Definition: pca_transform_batch.h:123
daal::algorithms::pca::transform::interface1::Batch::parameter
ParameterType parameter
Definition: pca_transform_batch.h:91
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::transform::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: pca_transform_batch.h:117
daal::algorithms::pca::transform::interface1::Batch
Computes the results of the PCA transformation algorithm in the batch processing mode.
Definition: pca_transform_batch.h:83
daal::services::ErrorNullResult
Definition: error_indexes.h:96

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