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

minmax.h
1 /* file: minmax.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 min-max normalization algorithm
21 // in the batch processing mode
22 //--
23 */
24 
25 #ifndef __MINMAX_BATCH_H__
26 #define __MINMAX_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/minmax_types.h"
32 
33 namespace daal
34 {
35 namespace algorithms
36 {
37 namespace normalization
38 {
39 namespace minmax
40 {
41 
42 namespace interface1
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);
67 
68  virtual ~BatchContainer();
69 
75  virtual services::Status compute() DAAL_C11_OVERRIDE;
76 };
77 
91 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
92 class DAAL_EXPORT Batch : public daal::algorithms::Analysis<batch>
93 {
94 public:
95  typedef algorithms::normalization::minmax::Input InputType;
96  typedef algorithms::normalization::minmax::Parameter<algorithmFPType> ParameterType;
97  typedef algorithms::normalization::minmax::Result ResultType;
98 
99  InputType input;
100  Parameter<algorithmFPType> parameter;
103  Batch()
104  {
105  initialize();
106  }
107 
113  Batch(const Batch<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
114  {
115  initialize();
116  }
117 
118  virtual ~Batch() {}
119 
124  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
125 
130  ResultPtr getResult()
131  {
132  return _result;
133  }
134 
141  services::Status setResult(const ResultPtr &result)
142  {
143  DAAL_CHECK(result, services::ErrorNullResult)
144  _result = result;
145  _res = _result.get();
146  return services::Status();
147  }
148 
154  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
155  {
156  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
157  }
158 
159 protected:
160  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
161  {
162  return new Batch<algorithmFPType, method>(*this);
163  }
164 
165  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
166  {
167  services::Status s = _result->allocate<algorithmFPType>(&input, method);
168  _res = _result.get();
169  return s;
170  }
171 
172  void initialize()
173  {
174  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
175  _in = &input;
176  _par = &parameter;
177  _result.reset(new ResultType());
178  }
179 
180  ResultPtr _result;
181 
182 };
184 } // namespace interface1
185 using interface1::BatchContainer;
186 using interface1::Batch;
187 
188 } // namespace minmax
189 } // namespace normalization
190 } // namespace algorithms
191 } // namespace daal
192 #endif
daal::batch
Definition: daal_defines.h:112
daal::algorithms::normalization::minmax::interface1::Batch::parameter
Parameter< algorithmFPType > parameter
Definition: minmax.h:100
daal::algorithms::normalization::minmax::interface1::Batch::input
InputType input
Definition: minmax.h:99
daal::algorithms::normalization::minmax::interface1::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::normalization::minmax::interface1::Batch::Batch
Batch()
Definition: minmax.h:103
daal::algorithms::normalization::minmax::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: minmax.h:124
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::minmax::interface1::Batch
Normalizes datasets in the batch processing mode.
Definition: minmax.h:92
daal_defines.h
daal::algorithms::normalization::minmax::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: minmax.h:154
daal::algorithms::normalization::minmax::interface1::BatchContainer::compute
virtual services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::normalization::minmax::interface1::Batch::getResult
ResultPtr getResult()
Definition: minmax.h:130
daal::algorithms::normalization::minmax::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: minmax.h:113
daal::algorithms::normalization::minmax::interface1::Parameter
Class that specifies the parameters of the algorithm in the batch computing mode. ...
Definition: minmax_types.h:125
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::minmax::interface1::BatchContainer
Provides methods to run implementations of the min-max normalization algorithm. It is associated with...
Definition: minmax.h:58
daal::algorithms::normalization::minmax::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: minmax.h:141

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