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

kernel_function_linear.h
1 /* file: kernel_function_linear.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 linear kernel function algorithm
19 //--
20 */
21 
22 #ifndef __KERNEL_FUNCTION_LINEAR_H__
23 #define __KERNEL_FUNCTION_LINEAR_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/numeric_table.h"
27 #include "algorithms/kernel_function/kernel_function_types_linear.h"
28 #include "algorithms/kernel_function/kernel_function.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 namespace kernel_function
35 {
36 namespace linear
37 {
38 
39 namespace interface1
40 {
56 template<typename algorithmFPType, Method method, CpuType cpu>
57 class DAAL_EXPORT BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
58 {
59 public:
65  BatchContainer(daal::services::Environment::env *daalEnv);
67  ~BatchContainer();
71  virtual services::Status compute() DAAL_C11_OVERRIDE;
72 };
73 
90 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
91 class DAAL_EXPORT Batch : public KernelIface
92 {
93 public:
94  typedef KernelIface super;
95 
96  typedef algorithms::kernel_function::linear::Input InputType;
97  typedef algorithms::kernel_function::linear::Parameter ParameterType;
98  typedef typename super::ResultType ResultType;
99 
100  ParameterType parameter;
101  InputType input;
104  Batch()
105  {
106  initialize();
107  }
108 
115  Batch(const Batch<algorithmFPType, method> &other) : KernelIface(other), parameter(other.parameter), input(other.input)
116  {
117  initialize();
118  }
119 
124  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int) method; }
125 
130  virtual InputType * getInput() DAAL_C11_OVERRIDE { return &input; }
131 
136  virtual ParameterBase * getParameter() DAAL_C11_OVERRIDE { return &parameter; }
137 
143  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
144  {
145  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
146  }
147 
148 protected:
149  void initialize()
150  {
151  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
152  _in = &input;
153  _par = &parameter;
154  }
155 
156  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
157  {
158  return new Batch<algorithmFPType, method>(*this);
159  }
160 
161  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
162  {
163  services::Status s = _result->allocate<algorithmFPType>(&input, &parameter, (int) method);
164  _res = _result.get();
165  return s;
166  }
167 };
169 } // namespace interface1
170 using interface1::BatchContainer;
171 using interface1::Batch;
172 
173 } // linear
174 } // namespace kernel_function
175 } // namespace algorithm
176 } // namespace daal
177 #endif
daal::algorithms::kernel_function::linear::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: kernel_function_linear.h:115
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::kernel_function::linear::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: kernel_function_linear.h:143
daal::algorithms::kernel_function::linear::interface1::Batch::getInput
virtual InputType * getInput() DAAL_C11_OVERRIDE
Definition: kernel_function_linear.h:130
daal::algorithms::kernel_function::linear::interface1::Batch::Batch
Batch()
Definition: kernel_function_linear.h:104
daal::algorithms::kernel_function::linear::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: kernel_function_linear.h:124
daal::algorithms::kernel_function::linear::interface1::BatchContainer
Provides methods to run implementations of the linear kernel function algorithm. This class is associ...
Definition: kernel_function_linear.h:57
daal::batch
Definition: daal_defines.h:110
daal::algorithms::kernel_function::linear::interface1::Batch::input
InputType input
Definition: kernel_function_linear.h:101
daal::algorithms::kernel_function::linear::interface1::Batch::parameter
ParameterType parameter
Definition: kernel_function_linear.h:100
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::kernel_function::linear::interface1::Batch
Computes a linear kernel function in the batch processing mode.
Definition: kernel_function_linear.h:91
daal::algorithms::kernel_function::linear::interface1::Batch::getParameter
virtual ParameterBase * getParameter() DAAL_C11_OVERRIDE
Definition: kernel_function_linear.h:136

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