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

iterative_solver_types.h
1 /* file: iterative_solver_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 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 iterative solver algorithm types.
45 //--
46 */
47 
48 #ifndef __ITERATIVE_SOLVER_TYPES_H__
49 #define __ITERATIVE_SOLVER_TYPES_H__
50 
51 #include "algorithms/algorithm.h"
52 #include "data_management/data/numeric_table.h"
53 #include "data_management/data/homogen_numeric_table.h"
54 #include "services/daal_defines.h"
55 #include "algorithms/optimization_solver/objective_function/sum_of_functions_batch.h"
56 
57 namespace daal
58 {
59 namespace algorithms
60 {
61 namespace optimization_solver
62 {
72 namespace iterative_solver
73 {
74 
79 enum InputId
80 {
81  inputArgument,
82  lastInputId = inputArgument
83 };
84 
89 enum OptionalInputId
90 {
91  optionalArgument = lastInputId + 1,
92  lastOptionalInputId = optionalArgument
93 };
94 
99 enum ResultId
100 {
101  minimum,
102  nIterations,
103  lastResultId = nIterations
104 };
105 
110 enum OptionalResultId
111 {
112  optionalResult = lastResultId + 1,
113  lastOptionalResultId = optionalResult
114 };
115 
120 enum OptionalDataId
121 {
122  lastIteration,
123  lastOptionalData = lastIteration
124 };
125 
129 namespace interface1
130 {
131 
138 /* [Parameter source code] */
139 struct DAAL_EXPORT Parameter : public daal::algorithms::Parameter
140 {
149  Parameter(const sum_of_functions::BatchPtr &function_, size_t nIterations_ = 100,
150  double accuracyThreshold_ = 1.0e-05, bool optionalResultReq_ = false, size_t batchSize_ = 1);
151 
156  Parameter(const Parameter &other);
157 
158  virtual ~Parameter() {}
159 
165  virtual services::Status check() const;
166 
167  sum_of_functions::BatchPtr function;
168  size_t nIterations;
169  double accuracyThreshold;
171  bool optionalResultRequired;
172  size_t batchSize;
177 };
178 /* [Parameter source code] */
179 
184 class DAAL_EXPORT Input : public daal::algorithms::Input
185 {
186 public:
187  Input();
188  Input(const Input& other);
189 
190  virtual ~Input() {}
191 
197  data_management::NumericTablePtr get(InputId id) const;
198 
204  algorithms::OptionalArgumentPtr get(OptionalInputId id) const;
205 
211  data_management::NumericTablePtr get(OptionalDataId id) const;
212 
218  void set(InputId id, const data_management::NumericTablePtr &ptr);
219 
225  void set(OptionalInputId id, const algorithms::OptionalArgumentPtr &ptr);
226 
232  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
240  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
241 };
242 
247 class DAAL_EXPORT Result : public daal::algorithms::Result
248 {
249 public:
250  DECLARE_SERIALIZABLE_CAST(Result);
251  Result() : daal::algorithms::Result(lastOptionalResultId + 1)
252  {}
253 
254  virtual ~Result() {};
255 
264  template <typename algorithmFPType>
265  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method);
266 
272  data_management::NumericTablePtr get(ResultId id) const;
273 
279  algorithms::OptionalArgumentPtr get(OptionalResultId id) const;
280 
286  data_management::NumericTablePtr get(OptionalDataId id) const;
287 
293  void set(ResultId id, const data_management::NumericTablePtr &ptr);
294 
300  void set(OptionalResultId id, const algorithms::OptionalArgumentPtr &ptr);
301 
307  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
308 
317  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par,
318  int method) const DAAL_C11_OVERRIDE;
319 
320 protected:
322  template<typename Archive, bool onDeserialize>
323  services::Status serialImpl(Archive *arch)
324  {
325  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
326  }
327 };
328 typedef services::SharedPtr<Result> ResultPtr;
329 
331 } // namespace interface1
332 using interface1::Parameter;
333 using interface1::Input;
334 using interface1::Result;
335 using interface1::ResultPtr;
336 
337 } // namespace iterative_solver
338 } // namespace optimization_solver
339 } // namespace algorithm
340 } // namespace daal
341 #endif
daal::algorithms::optimization_solver::iterative_solver::interface1::Parameter::optionalResultRequired
bool optionalResultRequired
Definition: iterative_solver_types.h:171
daal::algorithms::optimization_solver::iterative_solver::interface1::Parameter::nIterations
size_t nIterations
Definition: iterative_solver_types.h:168
daal::services::interface1::Status
Class that holds the results of API calls. In case of API routine failure it contains the list of err...
Definition: error_handling.h:491
daal
Definition: algorithm_base_common.h:57
daal::algorithms::optimization_solver::iterative_solver::interface1::Parameter::batchSize
size_t batchSize
Definition: iterative_solver_types.h:172
daal::algorithms::optimization_solver::iterative_solver::interface1::Result
Results obtained with the compute() method of the iterative solver algorithm in the batch processing ...
Definition: iterative_solver_types.h:247
daal::algorithms::interface1::Result
Base class to represent final results of the computation. Algorithm-specific final results are repres...
Definition: algorithm_types.h:331
daal::algorithms::optimization_solver::iterative_solver::InputId
InputId
Definition: iterative_solver_types.h:79
daal::algorithms::optimization_solver::iterative_solver::interface1::Parameter
Parameter base class for the iterative solver algorithm
Definition: iterative_solver_types.h:139
daal::algorithms::optimization_solver::iterative_solver::interface1::Input
Input parameters for the iterative solver algorithm
Definition: iterative_solver_types.h:184
daal_defines.h
daal::algorithms::optimization_solver::iterative_solver::OptionalDataId
OptionalDataId
Definition: iterative_solver_types.h:120
daal::algorithms::interface1::Parameter
Base class to represent computation parameters. Algorithm-specific parameters are represented as deri...
Definition: algorithm_types.h:86
daal::services::interface1::SharedPtr
Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr object...
Definition: daal_shared_ptr.h:187
daal::algorithms::optimization_solver::iterative_solver::minimum
Definition: iterative_solver_types.h:101
daal::algorithms::optimization_solver::iterative_solver::interface1::Parameter::accuracyThreshold
double accuracyThreshold
Definition: iterative_solver_types.h:169
daal::algorithms::optimization_solver::iterative_solver::ResultId
ResultId
Definition: iterative_solver_types.h:99
daal::algorithms::optimization_solver::iterative_solver::OptionalResultId
OptionalResultId
Definition: iterative_solver_types.h:110
daal::algorithms::optimization_solver::iterative_solver::lastIteration
Definition: iterative_solver_types.h:122
daal::algorithms::optimization_solver::iterative_solver::optionalResult
Definition: iterative_solver_types.h:112
daal::algorithms::optimization_solver::iterative_solver::OptionalInputId
OptionalInputId
Definition: iterative_solver_types.h:89
daal::algorithms::optimization_solver::iterative_solver::optionalArgument
Definition: iterative_solver_types.h:91
daal::algorithms::interface1::Input
Base class to represent computation input arguments. Algorithm-specific input arguments are represent...
Definition: algorithm_types.h:217
daal::algorithms::optimization_solver::iterative_solver::nIterations
Definition: iterative_solver_types.h:102
daal::algorithms::optimization_solver::iterative_solver::inputArgument
Definition: iterative_solver_types.h:81

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