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

mt19937.h
1 /* file: mt19937.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 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 __MT19937_H__
23 #define __MT19937_H__
24 
25 #include "algorithms/engines/mt19937/mt19937_types.h"
26 #include "algorithms/engines/engine.h"
27 
28 namespace daal
29 {
30 namespace algorithms
31 {
32 namespace engines
33 {
34 namespace mt19937
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::BatchBase
88 {
89 public:
90  typedef engines::BatchBase super;
91 
92  typedef typename super::InputType InputType;
93  typedef typename super::ResultType ResultType;
94 
101  static services::SharedPtr<Batch<algorithmFPType, method> > create(size_t seed = 777);
102 
107  virtual int getMethod() const DAAL_C11_OVERRIDE { return (int)method; }
108 
113  ResultPtr getResult() { return _result; }
114 
121  services::Status setResult(const ResultPtr& result)
122  {
123  DAAL_CHECK(result, services::ErrorNullResult)
124  _result = result;
125  _res = _result.get();
126  return services::Status();
127  }
128 
134  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
135  {
136  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
137  }
138 
144  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
145  {
146  services::Status s = this->_result->template allocate<algorithmFPType>(&(this->input), NULL, (int) method);
147  this->_res = this->_result.get();
148  return s;
149  }
150 
151 protected:
152  Batch(size_t seed = 777)
153  {
154  initialize();
155  }
156 
157  Batch(const Batch<algorithmFPType, method> &other): super(other)
158  {
159  initialize();
160  }
161 
162  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
163  {
164  return new Batch<algorithmFPType, method>(*this);
165  }
166 
167  void initialize()
168  {
169  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
170  _in = &input;
171  _result.reset(new ResultType());
172  }
173 
174 private:
175  ResultPtr _result;
176 };
177 typedef services::SharedPtr<Batch<> > mt19937Ptr;
178 typedef services::SharedPtr<const Batch<> > mt19937ConstPtr;
179 
180 } // namespace interface1
181 using interface1::BatchContainer;
182 using interface1::Batch;
183 using interface1::mt19937Ptr;
184 using interface1::mt19937ConstPtr;
186 } // namespace mt19937
187 } // namespace engines
188 } // namespace algorithms
189 } // namespace daal
190 #endif
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::engines::mt19937::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: mt19937.h:121
daal::algorithms::engines::mt19937::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: mt19937.h:107
daal::batch
Definition: daal_defines.h:106
daal::algorithms::engines::mt19937::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: mt19937.h:134
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::mt19937::interface1::Batch
Provides methods for mt19937 engine computations in the batch processing mode.
Definition: mt19937.h:87
daal::algorithms::engines::mt19937::interface1::Batch::allocateResult
virtual services::Status allocateResult() DAAL_C11_OVERRIDE
Definition: mt19937.h:144
daal::algorithms::engines::mt19937::interface1::Batch::getResult
ResultPtr getResult()
Definition: mt19937.h:113
daal::algorithms::engines::mt19937::interface1::BatchContainer
Provides methods to run implementations of the mt19937 engine. This class is associated with the mt19...
Definition: mt19937.h:54
daal::services::ErrorNullResult
Definition: error_indexes.h:96

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