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

zscore.h
1 /* file: zscore.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 z-score normalization algorithm
21 // in the batch processing mode
22 //--
23 */
24 
25 #ifndef __ZSCORE_BATCH_H__
26 #define __ZSCORE_BATCH_H__
27 
28 #include "algorithms/algorithm.h"
29 #include "data_management/data/numeric_table.h"
30 #include "services/daal_defines.h"
31 #include "algorithms/normalization/zscore_types.h"
32 
33 namespace daal
34 {
35 namespace algorithms
36 {
37 namespace normalization
38 {
39 namespace zscore
40 {
41 
42 namespace interface3
43 {
57 template<typename algorithmFPType, Method method, CpuType cpu>
58 class BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
59 {
60 public:
66  BatchContainer(daal::services::Environment::env *daalEnv);
68  virtual ~BatchContainer();
74  virtual services::Status compute() DAAL_C11_OVERRIDE;
75 };
76 
82 class DAAL_EXPORT BatchImpl : public daal::algorithms::Analysis<batch>
83 {
84 public:
85  typedef algorithms::normalization::zscore::Input InputType;
86  typedef algorithms::normalization::zscore::Result ResultType;
87 
89  BatchImpl()
90  {
91  initialize();
92  };
93 
101  BatchImpl(const BatchImpl &other) : input(other.input)
102  {
103  initialize();
104  }
105 
110  ResultPtr getResult()
111  {
112  return _result;
113  };
114 
120  DAAL_DEPRECATED_VIRTUAL virtual BaseParameter* getParameter() = 0;
121 
126  virtual BaseParameter& parameter() = 0;
127 
132  virtual const BaseParameter& parameter() const = 0;
133 
138  virtual services::Status setResult(const ResultPtr &result)
139  {
140  DAAL_CHECK(result, services::ErrorNullResult)
141  _result = result;
142  _res = _result.get();
143  return services::Status();
144  }
145 
152  services::SharedPtr<BatchImpl> clone() const
153  {
154  return services::SharedPtr<BatchImpl>(cloneImpl());
155  }
156 
157  virtual ~BatchImpl() {}
158 
159  InputType input;
161 protected:
162  ResultPtr _result;
163 
164  void initialize()
165  {
166  _result = ResultPtr(new ResultType());
167  _in = &input;
168  }
169  virtual BatchImpl * cloneImpl() const DAAL_C11_OVERRIDE = 0;
170 };
171 
186 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
187 class DAAL_EXPORT Batch : public BatchImpl
188 {
189 public:
190  typedef BatchImpl super;
191 
192  typedef typename super::InputType InputType;
193  typedef algorithms::normalization::zscore::Parameter<algorithmFPType, method> ParameterType;
194  typedef typename super::ResultType ResultType;
195 
196 
198  Batch();
199 
205  Batch(const Batch<algorithmFPType, method> &other);
206 
208  virtual ~Batch() DAAL_C11_OVERRIDE
209  {
210  delete _par;
211  }
212 
217  virtual ParameterType& parameter() DAAL_C11_OVERRIDE { return *static_cast<ParameterType*>(_par); }
218 
223  virtual const ParameterType& parameter() const DAAL_C11_OVERRIDE { return *static_cast<const ParameterType*>(_par); }
224 
230  DAAL_DEPRECATED_VIRTUAL virtual BaseParameter* getParameter() DAAL_C11_OVERRIDE { return &(this->Batch::parameter()); }
231 
236  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
237 
243  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
244  {
245  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
246  }
247 
248 protected:
249  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
250  {
251  return new Batch<algorithmFPType, method>(*this);
252  }
253 
254  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
255  {
256  services::Status s = _result->allocate<algorithmFPType>(&input, &(this->Batch::parameter()), method);
257  _res = _result.get();
258  return s;
259  }
260 
261  void initialize()
262  {
263  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
264  }
265 
266 };
267 
269 } // namespace interface3
270 using interface3::BatchContainer;
271 using interface3::BatchImpl;
272 using interface3::Batch;
273 
274 } // namespace zscore
275 } // namespace normalization
276 } // namespace algorithms
277 } // namespace daal
278 #endif
daal::algorithms::normalization::zscore::interface3::Batch
Normalizes datasets in the batch processing mode.
Definition: zscore.h:187
daal::algorithms::normalization::zscore::interface3::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)
daal::batch
Definition: daal_defines.h:112
daal::algorithms::normalization::zscore::interface3::BaseParameter
Class that specifies the base parameters of the algorithm in the batch computing mode.
Definition: zscore_types.h:260
daal::algorithms::normalization::zscore::interface3::BatchImpl::getResult
ResultPtr getResult()
Definition: zscore.h:110
daal::algorithms::normalization::zscore::interface3::BatchImpl::BatchImpl
BatchImpl(const BatchImpl &other)
Definition: zscore.h:101
daal::algorithms::normalization::zscore::interface3::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: zscore.h:243
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::algorithms::normalization::zscore::interface3::BatchImpl::input
InputType input
Definition: zscore.h:159
daal::algorithms::normalization::zscore::defaultDense
Definition: zscore_types.h:66
daal::algorithms::normalization::zscore::Method
Method
Definition: zscore_types.h:64
daal_defines.h
daal::algorithms::normalization::zscore::interface3::BatchImpl
Abstract class that specifies interface of the algorithms for computing correlation or variance-covar...
Definition: zscore.h:82
daal::algorithms::normalization::zscore::interface3::Batch::parameter
virtual ParameterType & parameter() DAAL_C11_OVERRIDE
Definition: zscore.h:217
daal::algorithms::normalization::zscore::interface3::Batch::getParameter
virtual DAAL_DEPRECATED_VIRTUAL BaseParameter * getParameter() DAAL_C11_OVERRIDE
Definition: zscore.h:230
daal::algorithms::normalization::zscore::interface3::BatchContainer::compute
virtual services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::normalization::zscore::interface3::BatchImpl::setResult
virtual services::Status setResult(const ResultPtr &result)
Definition: zscore.h:138
daal::algorithms::normalization::zscore::interface3::Batch::parameter
virtual const ParameterType & parameter() const DAAL_C11_OVERRIDE
Definition: zscore.h:223
daal::algorithms::normalization::zscore::interface3::BatchImpl::clone
services::SharedPtr< BatchImpl > clone() const
Definition: zscore.h:152
daal::algorithms::normalization::zscore::interface3::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: zscore.h:236
daal::algorithms::normalization::zscore::interface3::BatchContainer
Provides methods to run implementations of the z-score normalization algorithm. It is associated with...
Definition: zscore.h:58
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:70
daal::algorithms::normalization::zscore::interface3::BatchContainer::~BatchContainer
virtual ~BatchContainer()
daal::algorithms::normalization::zscore::interface3::Batch::~Batch
virtual ~Batch() DAAL_C11_OVERRIDE
Definition: zscore.h:208
daal::algorithms::normalization::zscore::interface3::BatchImpl::BatchImpl
BatchImpl()
Definition: zscore.h:89

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