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

mse_batch.h
1 /* file: mse_batch.h */
2 /*******************************************************************************
3 * Copyright 2014-2017 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of the mean squared error (MSE) objective function in the batch
45 // processing mode
46 //--
47 */
48 
49 #ifndef __MSE_BATCH_H__
50 #define __MSE_BATCH_H__
51 
52 #include "algorithms/algorithm.h"
53 #include "data_management/data/numeric_table.h"
54 #include "data_management/data/homogen_numeric_table.h"
55 #include "services/daal_defines.h"
56 #include "sum_of_functions_batch.h"
57 #include "mse_types.h"
58 
59 namespace daal
60 {
61 namespace algorithms
62 {
63 namespace optimization_solver
64 {
65 namespace mse
66 {
67 
68 namespace interface1
69 {
84 template<typename algorithmFPType, Method method, CpuType cpu>
85 class DAAL_EXPORT BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
86 {
87 public:
93  BatchContainer(daal::services::Environment::env *daalEnv);
95  virtual ~BatchContainer();
101  virtual services::Status compute() DAAL_C11_OVERRIDE;
102 };
103 
120 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
121 class DAAL_EXPORT Batch : public sum_of_functions::Batch
122 {
123 public:
127  Batch(size_t numberOfTerms) : parameter(numberOfTerms), sum_of_functions::Batch(numberOfTerms, &input, &parameter)
128  {
129  initialize();
130  }
131 
132  virtual ~Batch() {}
133 
140  Batch(const Batch<algorithmFPType, method> &other) :
141  parameter(other.parameter), sum_of_functions::Batch(other.parameter.numberOfTerms, &input, &parameter), input(other.input)
142  {
143  initialize();
144  }
145 
150  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
151 
157  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
158  {
159  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
160  }
161 
167  services::Status allocate()
168  {
169  return allocateResult();
170  }
171 
172 protected:
173  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
174  {
175  return new Batch<algorithmFPType, method>(*this);
176  }
177 
178  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
179  {
180  services::Status s = _result->allocate<algorithmFPType>(&input, &parameter, (int) method);
181  _res = _result.get();
182  return s;
183  }
184 
185  void initialize()
186  {
187  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
188  _in = &input;
189  _par = &parameter;
190  }
191 
192 public:
193  Input input;
194  Parameter parameter;
196 };
198 } // namespace interface1
199 using interface1::BatchContainer;
200 using interface1::Batch;
201 
202 } // namespace mse
203 } // namespace optimization_solver
204 } // namespace algorithm
205 } // namespace daal
206 #endif
daal
Definition: algorithm_base_common.h:57
daal::algorithms::optimization_solver::mse::interface1::Batch
Computes the Mean squared error objective function in the batch processing mode.
Definition: mse_batch.h:121
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:79
daal::algorithms::optimization_solver::mse::interface1::Batch::allocate
services::Status allocate()
Definition: mse_batch.h:167
daal::algorithms::optimization_solver::mse::interface1::Batch::input
Input input
Definition: mse_batch.h:193
daal::algorithms::optimization_solver::mse::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: mse_batch.h:150
daal::algorithms::optimization_solver::mse::interface1::Batch::parameter
Parameter parameter
Definition: mse_batch.h:194
daal::algorithms::optimization_solver::mse::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: mse_batch.h:157
daal::algorithms::optimization_solver::mse::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: mse_batch.h:140
daal_defines.h
daal::batch
Definition: daal_defines.h:131
daal::algorithms::optimization_solver::mse::interface1::Input
Input objects for the Mean squared error objective function
Definition: mse_types.h:146
daal::algorithms::optimization_solver::mse::interface1::Parameter
Parameter for Mean squared error objective function
Definition: mse_types.h:111
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:94
daal::algorithms::optimization_solver::mse::interface1::BatchContainer
Provides methods to run implementations of the mean squared error objective function. This class is associated with the Batch class and supports the method of computing the Mean squared error objective function in the batch processing mode.
Definition: mse_batch.h:85
daal::algorithms::optimization_solver::mse::interface1::Batch::Batch
Batch(size_t numberOfTerms)
Definition: mse_batch.h:127

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