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

zscore.h
1 /* file: zscore.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 z-score normalization algorithm
19 // in the batch processing mode
20 //--
21 */
22 
23 #ifndef __ZSCORE_BATCH_H__
24 #define __ZSCORE_BATCH_H__
25 
26 #include "algorithms/algorithm.h"
27 #include "data_management/data/numeric_table.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/normalization/zscore_types.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
35 namespace normalization
36 {
37 namespace zscore
38 {
39 
40 namespace interface2
41 {
55 template<typename algorithmFPType, Method method, CpuType cpu>
56 class DAAL_EXPORT BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
57 {
58 public:
64  BatchContainer(daal::services::Environment::env *daalEnv);
66  virtual ~BatchContainer();
72  virtual services::Status compute() DAAL_C11_OVERRIDE;
73 };
74 
80 class DAAL_EXPORT BatchImpl : public daal::algorithms::Analysis<batch>
81 {
82 public:
83  typedef algorithms::normalization::zscore::Input InputType;
84  typedef algorithms::normalization::zscore::Result ResultType;
85 
87  BatchImpl()
88  {
89  initialize();
90  };
91 
99  BatchImpl(const BatchImpl &other) : input(other.input)
100  {
101  initialize();
102  }
103 
108  ResultPtr getResult()
109  {
110  return _result;
111  };
112 
117  virtual BaseParameter* getParameter() = 0;
118 
123  virtual services::Status setResult(const ResultPtr &result)
124  {
125  DAAL_CHECK(result, services::ErrorNullResult)
126  _result = result;
127  _res = _result.get();
128  return services::Status();
129  }
130 
137  services::SharedPtr<BatchImpl> clone() const
138  {
139  return services::SharedPtr<BatchImpl>(cloneImpl());
140  }
141 
142  virtual ~BatchImpl() {}
143 
144  InputType input;
146 protected:
147  ResultPtr _result;
148 
149  void initialize()
150  {
151  _result = ResultPtr(new ResultType());
152  _in = &input;
153  }
154  virtual BatchImpl * cloneImpl() const DAAL_C11_OVERRIDE = 0;
155 };
156 
171 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
172 class DAAL_EXPORT Batch : public BatchImpl
173 {
174 public:
175  typedef BatchImpl super;
176 
177  typedef typename super::InputType InputType;
178  typedef algorithms::normalization::zscore::Parameter<algorithmFPType, method> ParameterType;
179  typedef typename super::ResultType ResultType;
180 
181  Parameter<algorithmFPType, method> parameter;
182 
184  Batch()
185  {
186  initialize();
187  }
188 
194  Batch(const Batch<algorithmFPType, method> &other) : BatchImpl(other), parameter(other.parameter)
195  {
196  initialize();
197  }
198 
199  virtual ~Batch() {}
200 
205  virtual BaseParameter* getParameter() DAAL_C11_OVERRIDE { return &parameter; }
206 
207 
212  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
213 
219  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
220  {
221  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
222  }
223 
224 protected:
225  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
226  {
227  return new Batch<algorithmFPType, method>(*this);
228  }
229 
230  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
231  {
232  services::Status s = _result->allocate<algorithmFPType>(&input, &parameter, method);
233  _res = _result.get();
234  return s;
235  }
236 
237  void initialize()
238  {
239  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
240  _par = &parameter;
241  }
242 
243 };
245 } // namespace interface2
246 using interface2::BatchContainer;
247 using interface2::BatchImpl;
248 using interface2::Batch;
249 
250 } // namespace zscore
251 } // namespace normalization
252 } // namespace algorithms
253 } // namespace daal
254 #endif
daal::algorithms::normalization::zscore::interface2::BaseParameter
Class that specifies the base parameters of the algorithm in the batch computing mode.
Definition: zscore_types.h:175
daal
Definition: algorithm_base_common.h:31
daal::algorithms::normalization::zscore::interface2::BatchImpl::BatchImpl
BatchImpl()
Definition: zscore.h:87
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:53
daal::algorithms::normalization::zscore::defaultDense
Definition: zscore_types.h:64
daal::algorithms::normalization::zscore::Method
Method
Definition: zscore_types.h:62
daal::algorithms::normalization::zscore::interface2::BatchImpl::setResult
virtual services::Status setResult(const ResultPtr &result)
Definition: zscore.h:123
daal::algorithms::normalization::zscore::interface2::Batch::getParameter
virtual BaseParameter * getParameter() DAAL_C11_OVERRIDE
Definition: zscore.h:205
daal::algorithms::normalization::zscore::interface2::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: zscore.h:194
daal_defines.h
daal::batch
Definition: daal_defines.h:106
daal::algorithms::normalization::zscore::interface2::Parameter
Class that specifies the parameters of the algorithm in the batch computing mode. ...
Definition: zscore_types.h:169
daal::algorithms::normalization::zscore::interface2::BatchImpl::clone
services::SharedPtr< BatchImpl > clone() const
Definition: zscore.h:137
daal::algorithms::normalization::zscore::interface2::BatchImpl
Abstract class that specifies interface of the algorithms for computing correlation or variance-covar...
Definition: zscore.h:80
daal::algorithms::normalization::zscore::interface2::BatchImpl::input
InputType input
Definition: zscore.h:144
daal::algorithms::normalization::zscore::interface2::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: zscore.h:219
daal::algorithms::normalization::zscore::interface2::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: zscore.h:212
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::normalization::zscore::interface2::BatchImpl::getResult
ResultPtr getResult()
Definition: zscore.h:108
daal::algorithms::normalization::zscore::interface2::BatchContainer
Provides methods to run implementations of the z-score normalization algorithm. It is associated with...
Definition: zscore.h:56
daal::algorithms::normalization::zscore::interface2::BatchImpl::BatchImpl
BatchImpl(const BatchImpl &other)
Definition: zscore.h:99
daal::algorithms::normalization::zscore::interface2::Batch::Batch
Batch()
Definition: zscore.h:184
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::normalization::zscore::interface2::Batch
Normalizes datasets in the batch processing mode.
Definition: zscore.h:172

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