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

tanh.h
1 /* file: tanh.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 hyperbolic tangent function
19 //--
20 */
21 
22 #ifndef __TANH_H__
23 #define __TANH_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/numeric_table.h"
27 #include "services/daal_defines.h"
28 #include "algorithms/math/tanh_types.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 namespace math
35 {
36 namespace tanh
37 {
38 namespace interface1
39 {
49 template<typename algorithmFPType, Method method, CpuType cpu>
50 class DAAL_EXPORT BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
51 {
52 public:
58  BatchContainer(daal::services::Environment::env *daalEnv);
60  ~BatchContainer();
66  virtual services::Status compute() DAAL_C11_OVERRIDE;
67 };
68 
83 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
84 class DAAL_EXPORT Batch : public daal::algorithms::Analysis<batch>
85 {
86 public:
87  typedef algorithms::math::tanh::Input InputType;
88  typedef algorithms::math::tanh::Result ResultType;
89 
91  Batch()
92  {
93  initialize();
94  }
95 
100  Batch(const Batch<algorithmFPType, method> &other) : input(other.input)
101  {
102  initialize();
103  }
104 
109  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int) method; }
110 
115  ResultPtr getResult()
116  {
117  return _result;
118  }
119 
126  services::Status setResult(const ResultPtr &result)
127  {
128  DAAL_CHECK(result, services::ErrorNullResult)
129  _result = result;
130  _res = _result.get();
131  return services::Status();
132  }
133 
134  InputType input;
141  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
142  {
143  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
144  }
145 
146 protected:
147  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
148  {
149  return new Batch<algorithmFPType, method>(*this);
150  }
151 
152  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
153  {
154  _result.reset(new ResultType());
155  services::Status s = _result->allocate<algorithmFPType>(&input, NULL, (int) method);
156  _res = _result.get();
157  return s;
158  }
159 
160  void initialize()
161  {
162  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
163  _in = &input;
164  }
165 private:
166  ResultPtr _result;
167 };
169 } // namespace interface1
170 using interface1::BatchContainer;
171 using interface1::Batch;
172 
173 } // namespace tanh
174 } // namespace math
175 } // namespace algorithms
176 } // namespace daal
177 #endif
daal::algorithms::math::tanh::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: tanh.h:109
daal
Definition: algorithm_base_common.h:31
daal::algorithms::math::tanh::interface1::Batch::input
InputType input
Definition: tanh.h:134
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:53
daal::algorithms::math::tanh::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: tanh.h:100
daal::algorithms::math::tanh::interface1::Batch::getResult
ResultPtr getResult()
Definition: tanh.h:115
daal::algorithms::math::tanh::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: tanh.h:141
daal::algorithms::math::tanh::interface1::BatchContainer
Class containing methods for the hyperbolic tangent function computing using algorithmFPType precisio...
Definition: tanh.h:50
daal_defines.h
daal::algorithms::math::tanh::interface1::Batch::Batch
Batch()
Definition: tanh.h:91
daal::batch
Definition: daal_defines.h:110
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::math::tanh::interface1::Batch
Computes the hyperbolic tangent function in the batch processing mode.
Definition: tanh.h:84
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::math::tanh::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: tanh.h:126

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