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

mt2203.h
1 /* file: mt2203.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 Mersenne Twister engine in the batch processing mode
19 //--
20 */
21 
22 #ifndef __MT2203_H__
23 #define __MT2203_H__
24 
25 #include "algorithms/engines/mt2203/mt2203_types.h"
26 #include "algorithms/engines/engine_family.h"
27 
28 namespace daal
29 {
30 namespace algorithms
31 {
32 namespace engines
33 {
34 namespace mt2203
35 {
41 namespace interface1
42 {
53 template<typename algorithmFPType, Method method, CpuType cpu>
54 class DAAL_EXPORT BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
55 {
56 public:
62  BatchContainer(daal::services::Environment::env *daalEnv);
63  ~BatchContainer();
69  services::Status compute() DAAL_C11_OVERRIDE;
70 };
71 
86 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
87 class DAAL_EXPORT Batch : public engines::FamilyBatchBase
88 {
89 public:
90  typedef engines::FamilyBatchBase super;
91 
92  typedef typename super::InputType InputType;
93  typedef typename super::ResultType ResultType;
94 
102  static services::SharedPtr<Batch<algorithmFPType, method> > create(size_t seed = 777, services::Status *st = NULL);
103 
108  virtual int getMethod() const DAAL_C11_OVERRIDE { return (int)method; }
109 
114  ResultPtr getResult() { return _result; }
115 
122  services::Status setResult(const ResultPtr& result)
123  {
124  DAAL_CHECK(result, services::ErrorNullResult)
125  _result = result;
126  _res = _result.get();
127  return services::Status();
128  }
129 
135  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
136  {
137  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
138  }
139 
145  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
146  {
147  services::Status s = this->_result->template allocate<algorithmFPType>(&(this->input), NULL, (int) method);
148  this->_res = this->_result.get();
149  return s;
150  }
151 
152 protected:
153  Batch(size_t seed = 777): super()
154  {
155  initialize();
156  }
157 
158  Batch(const Batch<algorithmFPType, method> &other): super(other)
159  {
160  initialize();
161  }
162 
163  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
164  {
165  return new Batch<algorithmFPType, method>(*this);
166  }
167 
168  void initialize()
169  {
170  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
171  _in = &input;
172  _result.reset(new ResultType());
173  }
174 
175 private:
176  ResultPtr _result;
177 };
178 typedef services::SharedPtr<Batch<> > mt2203Ptr;
179 typedef services::SharedPtr<const Batch<> > mt2203ConstPtr;
180 
181 } // namespace interface1
182 using interface1::BatchContainer;
183 using interface1::Batch;
184 using interface1::mt2203Ptr;
185 using interface1::mt2203ConstPtr;
187 } // namespace mt2203
188 } // namespace engines
189 } // namespace algorithms
190 } // namespace daal
191 #endif
daal::algorithms::engines::mt2203::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: mt2203.h:108
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::batch
Definition: daal_defines.h:110
daal::algorithms::engines::mt2203::interface1::Batch::getResult
ResultPtr getResult()
Definition: mt2203.h:114
daal::algorithms::engines::mt2203::interface1::Batch::allocateResult
virtual services::Status allocateResult() DAAL_C11_OVERRIDE
Definition: mt2203.h:145
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::engines::mt2203::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: mt2203.h:122
daal::algorithms::engines::mt2203::interface1::Batch
Provides methods for mt2203 engine computations in the batch processing mode.
Definition: mt2203.h:87
daal::algorithms::engines::mt2203::interface1::BatchContainer
Provides methods to run implementations of the mt2203 engine. This class is associated with the mt220...
Definition: mt2203.h:54
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::engines::mt2203::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: mt2203.h:135

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