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

zscore.h
1 /* file: zscore.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 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 interface3
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 
118  DAAL_DEPRECATED_VIRTUAL virtual BaseParameter* getParameter() = 0;
119 
124  virtual BaseParameter& parameter() = 0;
125 
130  virtual const BaseParameter& parameter() const = 0;
131 
136  virtual services::Status setResult(const ResultPtr &result)
137  {
138  DAAL_CHECK(result, services::ErrorNullResult)
139  _result = result;
140  _res = _result.get();
141  return services::Status();
142  }
143 
150  services::SharedPtr<BatchImpl> clone() const
151  {
152  return services::SharedPtr<BatchImpl>(cloneImpl());
153  }
154 
155  virtual ~BatchImpl() {}
156 
157  InputType input;
159 protected:
160  ResultPtr _result;
161 
162  void initialize()
163  {
164  _result = ResultPtr(new ResultType());
165  _in = &input;
166  }
167  virtual BatchImpl * cloneImpl() const DAAL_C11_OVERRIDE = 0;
168 };
169 
184 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
185 class DAAL_EXPORT Batch : public BatchImpl
186 {
187 public:
188  typedef BatchImpl super;
189 
190  typedef typename super::InputType InputType;
191  typedef algorithms::normalization::zscore::Parameter<algorithmFPType, method> ParameterType;
192  typedef typename super::ResultType ResultType;
193 
194 
196  Batch();
197 
203  Batch(const Batch<algorithmFPType, method> &other);
204 
206  virtual ~Batch() DAAL_C11_OVERRIDE
207  {
208  delete _par;
209  }
210 
215  virtual ParameterType& parameter() DAAL_C11_OVERRIDE { return *static_cast<ParameterType*>(_par); }
216 
221  virtual const ParameterType& parameter() const DAAL_C11_OVERRIDE { return *static_cast<const ParameterType*>(_par); }
222 
228  DAAL_DEPRECATED_VIRTUAL virtual BaseParameter* getParameter() DAAL_C11_OVERRIDE { return &(this->Batch::parameter()); }
229 
234  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
235 
241  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
242  {
243  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
244  }
245 
246 protected:
247  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
248  {
249  return new Batch<algorithmFPType, method>(*this);
250  }
251 
252  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
253  {
254  services::Status s = _result->allocate<algorithmFPType>(&input, &(this->Batch::parameter()), method);
255  _res = _result.get();
256  return s;
257  }
258 
259  void initialize()
260  {
261  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
262  }
263 
264 };
265 
267 } // namespace interface3
268 using interface3::BatchContainer;
269 using interface3::BatchImpl;
270 using interface3::Batch;
271 
272 } // namespace zscore
273 } // namespace normalization
274 } // namespace algorithms
275 } // namespace daal
276 #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::normalization::zscore::defaultDense
Definition: zscore_types.h:64
daal::algorithms::normalization::zscore::interface3::BatchImpl::getResult
ResultPtr getResult()
Definition: zscore.h:108
daal::algorithms::normalization::zscore::Method
Method
Definition: zscore_types.h:62
daal::algorithms::normalization::zscore::interface3::Batch::parameter
virtual ParameterType & parameter() DAAL_C11_OVERRIDE
Definition: zscore.h:215
daal::algorithms::normalization::zscore::interface3::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: zscore.h:241
daal::algorithms::normalization::zscore::interface3::Batch::getParameter
virtual DAAL_DEPRECATED_VIRTUAL BaseParameter * getParameter() DAAL_C11_OVERRIDE
Definition: zscore.h:228
daal_defines.h
daal::algorithms::normalization::zscore::interface3::Batch::~Batch
virtual ~Batch() DAAL_C11_OVERRIDE
Definition: zscore.h:206
daal::batch
Definition: daal_defines.h:110
daal::algorithms::normalization::zscore::interface3::BatchImpl::clone
services::SharedPtr< BatchImpl > clone() const
Definition: zscore.h:150
daal::algorithms::normalization::zscore::interface3::BatchImpl::BatchImpl
BatchImpl()
Definition: zscore.h:87
daal::algorithms::normalization::zscore::interface3::BatchContainer
Provides methods to run implementations of the z-score normalization algorithm. It is associated with...
Definition: zscore.h:56
daal::algorithms::normalization::zscore::interface3::BatchImpl
Abstract class that specifies interface of the algorithms for computing correlation or variance-covar...
Definition: zscore.h:80
daal::algorithms::normalization::zscore::interface3::BatchImpl::BatchImpl
BatchImpl(const BatchImpl &other)
Definition: zscore.h:99
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::interface3::BatchImpl::input
InputType input
Definition: zscore.h:157
daal::algorithms::normalization::zscore::interface3::BaseParameter
Class that specifies the base parameters of the algorithm in the batch computing mode.
Definition: zscore_types.h:258
daal::algorithms::normalization::zscore::interface3::BatchImpl::setResult
virtual services::Status setResult(const ResultPtr &result)
Definition: zscore.h:136
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::normalization::zscore::interface3::Batch
Normalizes datasets in the batch processing mode.
Definition: zscore.h:185
daal::algorithms::normalization::zscore::interface3::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: zscore.h:234
daal::algorithms::normalization::zscore::interface3::Batch::parameter
virtual const ParameterType & parameter() const DAAL_C11_OVERRIDE
Definition: zscore.h:221

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