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

low_order_moments_types.h
1 /* file: low_order_moments_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 // Definition of LowOrderMoments common types.
45 //--
46 */
47 
48 #ifndef __LOW_ORDER_MOMENTS_TYPES_H__
49 #define __LOW_ORDER_MOMENTS_TYPES_H__
50 
51 #include "data_management/data/homogen_numeric_table.h"
52 
53 namespace daal
54 {
55 namespace algorithms
56 {
66 namespace low_order_moments
67 {
72 enum Method
73 {
74  defaultDense = 0,
75  singlePassDense = 1,
77  sumDense = 2,
79  fastCSR = 3,
80  singlePassCSR = 4,
82  sumCSR = 5
84 };
85 
90 enum EstimatesToCompute
91 {
92  estimatesAll,
93  estimatesMinMax,
94  estimatesMeanVariance
95 };
96 
101 enum InputId
102 {
103  data,
104  lastInputId = data
105 };
106 
111 enum ResultId
112 {
113  minimum,
114  maximum,
115  sum,
116  sumSquares,
117  sumSquaresCentered,
118  mean,
119  secondOrderRawMoment,
120  variance,
121  standardDeviation,
122  variation,
123  lastResultId = variation
124 };
125 
130 enum PartialResultId
131 {
132  nObservations,
133  partialMinimum,
134  partialMaximum,
135  partialSum,
136  partialSumSquares,
137  partialSumSquaresCentered,
138  lastPartialResultId = partialSumSquaresCentered
139 };
140 
145 enum MasterInputId
146 {
147  partialResults,
148  lastMasterInputId = partialResults
149 };
150 
154 namespace interface1
155 {
160 class InputIface : public daal::algorithms::Input
161 {
162 public:
163  InputIface(size_t nElements) : daal::algorithms::Input(nElements) {}
164  InputIface(const InputIface& other) : daal::algorithms::Input(other){}
165  virtual services::Status getNumberOfColumns(size_t& nCols) const = 0;
166  virtual ~InputIface() {}
167 };
168 
173 class DAAL_EXPORT Input : public InputIface
174 {
175 public:
176  Input();
177  Input(const Input& other);
178 
179  virtual ~Input() {};
180 
186  services::Status getNumberOfColumns(size_t& nCols) const DAAL_C11_OVERRIDE;
187 
193  data_management::NumericTablePtr get(InputId id) const;
194 
200  void set(InputId id, const data_management::NumericTablePtr &ptr);
201 
202  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
203 };
204 
211 class DAAL_EXPORT PartialResult : public daal::algorithms::PartialResult
212 {
213 public:
214 
215  DECLARE_SERIALIZABLE_CAST(PartialResult);
216  PartialResult();
217 
218  virtual ~PartialResult()
219  {}
220 
227  template <typename algorithmFPType>
228  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
229 
237  template <typename algorithmFPType>
238  DAAL_EXPORT services::Status initialize(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
239 
245  services::Status getNumberOfColumns(size_t& nCols) const;
246 
252  data_management::NumericTablePtr get(PartialResultId id) const;
253 
259  void set(PartialResultId id, const data_management::NumericTablePtr &ptr);
260 
266  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
267 
274  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
275 
276 protected:
278  template<typename Archive, bool onDeserialize>
279  services::Status serialImpl(Archive *arch)
280  {
281  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
282  }
283 
284  services::Status checkImpl(size_t nFeatures) const;
285 };
286 
287 typedef services::SharedPtr<PartialResult> PartialResultPtr;
288 
293 struct DAAL_EXPORT Parameter : public daal::algorithms::Parameter
294 {
296  Parameter(EstimatesToCompute _estimatesToCompute = estimatesAll);
297 
298  EstimatesToCompute estimatesToCompute;
300  services::Status check() const DAAL_C11_OVERRIDE;
301 };
302 
308 class DAAL_EXPORT Result : public daal::algorithms::Result
309 {
310 public:
311  DECLARE_SERIALIZABLE_CAST(Result);
312  Result();
313 
314  virtual ~Result() {};
315 
322  template <typename algorithmFPType>
323  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
324 
331  template <typename algorithmFPType>
332  DAAL_EXPORT services::Status allocate(const daal::algorithms::PartialResult *partialResult, daal::algorithms::Parameter *parameter, const int method);
333 
339  data_management::NumericTablePtr get(ResultId id) const;
340 
346  void set(ResultId id, const data_management::NumericTablePtr &value);
347 
354  services::Status check(const daal::algorithms::PartialResult *partialResult, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
355 
362  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
363 
364 protected:
366  template<typename Archive, bool onDeserialize>
367  services::Status serialImpl(Archive *arch)
368  {
369  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
370  }
371 
372  services::Status checkImpl(size_t nFeatures) const;
373 };
374 typedef services::SharedPtr<Result> ResultPtr;
375 
382 template<ComputeStep step>
383 class DAAL_EXPORT DistributedInput : public InputIface
384 {
385 public:
386  DistributedInput();
387  DistributedInput(const DistributedInput& other);
388 
389  virtual ~DistributedInput() {}
390 
396  services::Status getNumberOfColumns(size_t& nCols) const DAAL_C11_OVERRIDE;
397 
403  void add(MasterInputId id, const PartialResultPtr &partialResult);
404 
410  void set(MasterInputId id, const data_management::DataCollectionPtr &ptr);
411 
417  data_management::DataCollectionPtr get(MasterInputId id) const;
418 
424  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
425 };
427 } // namespace interface1
428 using interface1::InputIface;
429 using interface1::Input;
430 using interface1::PartialResult;
431 using interface1::PartialResultPtr;
432 using interface1::Parameter;
433 using interface1::Result;
434 using interface1::ResultPtr;
435 using interface1::DistributedInput;
436 
437 } // namespace daal::algorithms::low_order_moments
438 }
439 }
440 #endif
daal::algorithms::low_order_moments::partialMaximum
Definition: low_order_moments_types.h:134
daal::algorithms::interface1::Input::Input
Input()
Definition: algorithm_types.h:223
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::low_order_moments::partialResults
Definition: low_order_moments_types.h:147
daal::algorithms::low_order_moments::partialSumSquaresCentered
Definition: low_order_moments_types.h:137
daal::algorithms::low_order_moments::defaultDense
Definition: low_order_moments_types.h:74
daal::algorithms::low_order_moments::sumCSR
Definition: low_order_moments_types.h:82
daal::algorithms::low_order_moments::interface1::Result
Provides methods to access final results obtained with the compute() method of the low order moments ...
Definition: low_order_moments_types.h:308
daal::algorithms::low_order_moments::sum
Definition: low_order_moments_types.h:115
daal::algorithms::low_order_moments::variance
Definition: low_order_moments_types.h:120
daal::algorithms::low_order_moments::maximum
Definition: low_order_moments_types.h:114
daal::algorithms::low_order_moments::data
Definition: low_order_moments_types.h:103
daal::algorithms::interface1::PartialResult
Base class to represent partial results of the computation. Algorithm-specific partial results are re...
Definition: algorithm_types.h:253
daal::algorithms::low_order_moments::minimum
Definition: low_order_moments_types.h:113
daal::algorithms::low_order_moments::estimatesMeanVariance
Definition: low_order_moments_types.h:94
daal::algorithms::low_order_moments::InputId
InputId
Definition: low_order_moments_types.h:101
daal::algorithms::low_order_moments::sumSquares
Definition: low_order_moments_types.h:116
daal::algorithms::interface1::Parameter
Base class to represent computation parameters. Algorithm-specific parameters are represented as deri...
Definition: algorithm_types.h:86
daal::algorithms::low_order_moments::partialSum
Definition: low_order_moments_types.h:135
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::low_order_moments::ResultId
ResultId
Definition: low_order_moments_types.h:111
daal::algorithms::low_order_moments::fastCSR
Definition: low_order_moments_types.h:79
daal::algorithms::low_order_moments::interface1::InputIface
Abstract class that specifies interface of the input objects for the low order moments algorithm...
Definition: low_order_moments_types.h:160
daal::algorithms::low_order_moments::mean
Definition: low_order_moments_types.h:118
daal::algorithms::low_order_moments::interface1::Parameter
Low order moments algorithm parameters.
Definition: low_order_moments_types.h:293
daal::algorithms::interface1::Input::check
virtual services::Status check(const Parameter *parameter, int method) const
Definition: algorithm_types.h:238
daal::algorithms::low_order_moments::estimatesAll
Definition: low_order_moments_types.h:92
daal::algorithms::low_order_moments::EstimatesToCompute
EstimatesToCompute
Definition: low_order_moments_types.h:90
daal::algorithms::low_order_moments::interface1::DistributedInput
Input objects for the low order moments algorithm in the distributed processing mode on master node...
Definition: low_order_moments_types.h:383
daal::algorithms::low_order_moments::nObservations
Definition: low_order_moments_types.h:132
daal::algorithms::low_order_moments::secondOrderRawMoment
Definition: low_order_moments_types.h:119
daal::algorithms::low_order_moments::singlePassCSR
Definition: low_order_moments_types.h:80
daal::algorithms::low_order_moments::interface1::Parameter::estimatesToCompute
EstimatesToCompute estimatesToCompute
Definition: low_order_moments_types.h:298
daal::algorithms::low_order_moments::estimatesMinMax
Definition: low_order_moments_types.h:93
daal::algorithms::math::abs::value
Definition: abs_types.h:112
daal::algorithms::low_order_moments::partialSumSquares
Definition: low_order_moments_types.h:136
daal::algorithms::low_order_moments::standardDeviation
Definition: low_order_moments_types.h:121
daal::algorithms::low_order_moments::variation
Definition: low_order_moments_types.h:122
daal::algorithms::low_order_moments::interface1::Input
Input objects for the low order moments algorithm
Definition: low_order_moments_types.h:173
daal::algorithms::low_order_moments::singlePassDense
Definition: low_order_moments_types.h:75
daal::algorithms::low_order_moments::MasterInputId
MasterInputId
Available identifiers of input objects for the low order moments algorithm on the master node...
Definition: low_order_moments_types.h:145
daal::algorithms::low_order_moments::sumDense
Definition: low_order_moments_types.h:77
daal::algorithms::low_order_moments::Method
Method
Definition: low_order_moments_types.h:72
daal::algorithms::low_order_moments::sumSquaresCentered
Definition: low_order_moments_types.h:117
daal::algorithms::interface1::Input
Base class to represent computation input arguments. Algorithm-specific input arguments are represent...
Definition: algorithm_types.h:217
daal::algorithms::low_order_moments::interface1::PartialResult
Provides methods to access partial results obtained with the compute() method of the low order moment...
Definition: low_order_moments_types.h:211
daal::algorithms::low_order_moments::PartialResultId
PartialResultId
Definition: low_order_moments_types.h:130
daal::algorithms::low_order_moments::partialMinimum
Definition: low_order_moments_types.h:133

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