C++ API Reference for Intel® Data Analytics Acceleration Library 2020 Update 1

pca_batch.h
1 /* file: pca_batch.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Implementation of the interface for the PCA algorithm in the batch processing mode
21 //--
22 */
23 
24 #ifndef __PCA_BATCH_H__
25 #define __PCA_BATCH_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "data_management/data/numeric_table.h"
29 #include "services/daal_defines.h"
30 #include "services/daal_memory.h"
31 #include "algorithms/pca/pca_types.h"
32 
33 namespace daal
34 {
35 namespace algorithms
36 {
37 namespace pca
38 {
39 
40 namespace interface3
41 {
48 template<typename algorithmFPType, Method method, CpuType cpu>
49 class BatchContainer : public AnalysisContainerIface<batch>
50 {};
51 
55 template<typename algorithmFPType, CpuType cpu>
56 class 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 };
80 template<typename algorithmFPType, CpuType cpu>
81 class BatchContainer<algorithmFPType, svdDense, cpu> : public AnalysisContainerIface<batch>
82 {
83 public:
89  BatchContainer(daal::services::Environment::env *daalEnv);
91  ~BatchContainer();
95  services::Status compute() DAAL_C11_OVERRIDE;
96 };
108 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = correlationDense>
109 class DAAL_EXPORT Batch : public Analysis<batch>
110 {
111 public:
112  typedef algorithms::pca::Input InputType;
113  typedef algorithms::pca::BatchParameter<algorithmFPType, method> ParameterType;
114  typedef algorithms::pca::Result ResultType;
115 
117  Batch()
118  {
119  initialize();
120  }
121 
127  Batch(const Batch<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
128  {
129  initialize();
130  }
131 
132  ~Batch() {}
133 
138  virtual int getMethod() const DAAL_C11_OVERRIDE { return method; };
139 
144  services::Status setResult(const ResultPtr& res)
145  {
146  DAAL_CHECK(res, services::ErrorNullResult)
147  _result = res;
148  _res = _result.get();
149  return services::Status();
150  }
151 
156  ResultPtr getResult() { return _result; }
157 
163  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
164  {
165  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
166  }
167 
168  InputType input;
169  BatchParameter<algorithmFPType, method> parameter;
171 protected:
172  ResultPtr _result;
173 
174  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
175  {
176  return new Batch<algorithmFPType, method>(*this);
177  }
178 
179  services::Status allocateResult() DAAL_C11_OVERRIDE
180  {
181  services::Status s = _result->allocate<algorithmFPType>(&input, &parameter, method);
182  _res = _result.get();
183  return s;
184  }
185 
186  void initialize()
187  {
188  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
189  _in = &input;
190  _par = &parameter;
191  _result.reset(new ResultType());
192  }
193 };
194 
196 } // namespace interface3
197 using interface3::BatchContainer;
198 using interface3::Batch;
199 
200 } // namespace pca
201 } // namespace algorithms
202 } // namespace daal
203 #endif
daal::algorithms::pca::interface3::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: pca_batch.h:163
daal::algorithms::pca::interface3::Batch::getResult
ResultPtr getResult()
Definition: pca_batch.h:156
daal::batch
Definition: daal_defines.h:112
daal::algorithms::pca::correlationDense
Definition: pca_types.h:57
daal::algorithms::pca::interface3::Batch::parameter
BatchParameter< algorithmFPType, method > parameter
Definition: pca_batch.h:169
daal::algorithms::pca::interface3::BatchParameter
Class that specifies the parameters of the PCA algorithm in the batch computing mode.
Definition: pca_types.h:678
daal::algorithms::pca::interface3::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: pca_batch.h:138
daal::algorithms::pca::svdDense
Definition: pca_types.h:59
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:55
daal_defines.h
daal::algorithms::pca::interface3::Batch::setResult
services::Status setResult(const ResultPtr &res)
Definition: pca_batch.h:144
daal::algorithms::pca::interface3::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: pca_batch.h:127
daal::algorithms::pca::interface3::Batch::Batch
Batch()
Definition: pca_batch.h:117
daal::algorithms::pca::interface3::Batch::input
InputType input
Definition: pca_batch.h:168
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:70
daal::algorithms::pca::interface3::Batch
Computes the results of the PCA algorithm.
Definition: pca_batch.h:109
daal::algorithms::pca::interface3::BatchContainer
Contains version 3.0 of Intel(R) Data Analytics Acceleration Library (Intel(R) DAAL) interface...
Definition: pca_batch.h:49

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