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

mt2203.h
1 /* file: mt2203.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Implementation of the Mersenne Twister engine in the batch processing mode
21 //--
22 */
23 
24 #ifndef __MT2203_H__
25 #define __MT2203_H__
26 
27 #include "algorithms/engines/mt2203/mt2203_types.h"
28 #include "algorithms/engines/engine_family.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 namespace engines
35 {
36 namespace mt2203
37 {
43 namespace interface1
44 {
55 template<typename algorithmFPType, Method method, CpuType cpu>
56 class BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
57 {
58 public:
64  BatchContainer(daal::services::Environment::env *daalEnv);
65  ~BatchContainer();
71  services::Status compute() DAAL_C11_OVERRIDE;
72 };
73 
88 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
89 class DAAL_EXPORT Batch : public engines::FamilyBatchBase
90 {
91 public:
92  typedef engines::FamilyBatchBase super;
93 
94  typedef typename super::InputType InputType;
95  typedef typename super::ResultType ResultType;
96 
104  static services::SharedPtr<Batch<algorithmFPType, method> > create(size_t seed = 777, services::Status *st = NULL);
105 
110  virtual int getMethod() const DAAL_C11_OVERRIDE { return (int)method; }
111 
116  ResultPtr getResult() { return _result; }
117 
124  services::Status setResult(const ResultPtr& result)
125  {
126  DAAL_CHECK(result, services::ErrorNullResult)
127  _result = result;
128  _res = _result.get();
129  return services::Status();
130  }
131 
137  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
138  {
139  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
140  }
141 
147  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
148  {
149  services::Status s = this->_result->template allocate<algorithmFPType>(&(this->input), NULL, (int) method);
150  this->_res = this->_result.get();
151  return s;
152  }
153 
154 protected:
155  Batch(size_t seed = 777): super()
156  {
157  initialize();
158  }
159 
160  Batch(const Batch<algorithmFPType, method> &other): super(other)
161  {
162  initialize();
163  }
164 
165  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
166  {
167  return new Batch<algorithmFPType, method>(*this);
168  }
169 
170  void initialize()
171  {
172  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
173  _in = &input;
174  _result.reset(new ResultType());
175  }
176 
177 private:
178  ResultPtr _result;
179 };
180 typedef services::SharedPtr<Batch<> > mt2203Ptr;
181 typedef services::SharedPtr<const Batch<> > mt2203ConstPtr;
182 
183 } // namespace interface1
184 using interface1::BatchContainer;
185 using interface1::Batch;
186 using interface1::mt2203Ptr;
187 using interface1::mt2203ConstPtr;
189 } // namespace mt2203
190 } // namespace engines
191 } // namespace algorithms
192 } // namespace daal
193 #endif
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:56
daal::algorithms::engines::mt2203::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: mt2203.h:124
daal::batch
Definition: daal_defines.h:112
daal::algorithms::engines::mt2203::interface1::Batch::getResult
ResultPtr getResult()
Definition: mt2203.h:116
daal::algorithms::engines::mt2203::interface1::BatchContainer::compute
services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::engines::mt2203::interface1::Batch::allocateResult
virtual services::Status allocateResult() DAAL_C11_OVERRIDE
Definition: mt2203.h:147
daal::algorithms::engines::mt2203::interface1::Batch
Provides methods for mt2203 engine computations in the batch processing mode.
Definition: mt2203.h:89
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:55
daal::algorithms::engines::mt2203::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: mt2203.h:137
daal::algorithms::engines::mt2203::interface1::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:70
daal::algorithms::engines::mt2203::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: mt2203.h:110

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