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

em_gmm_init_batch.h
1 /* file: em_gmm_init_batch.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 interface of the EM for GMM initialization algorithm
19 //--
20 */
21 
22 #ifndef __EM_GMM_INIT_BATCH_H__
23 #define __EM_GMM_INIT_BATCH_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/numeric_table.h"
27 #include "services/daal_defines.h"
28 #include "em_gmm_init_types.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 namespace em_gmm
35 {
36 namespace init
37 {
38 
39 namespace interface1
40 {
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();
67  virtual services::Status compute() DAAL_C11_OVERRIDE;
68 };
69 
79 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
80 class DAAL_EXPORT Batch : public daal::algorithms::Analysis<batch>
81 {
82 public:
83  typedef algorithms::em_gmm::init::Input InputType;
84  typedef algorithms::em_gmm::init::Parameter ParameterType;
85  typedef algorithms::em_gmm::init::Result ResultType;
86 
87  Batch(const size_t nComponents) : parameter(nComponents)
88  {
89  initialize();
90  }
91 
98  Batch(const Batch<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
99  {
100  initialize();
101  }
102 
107  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)0; }
108 
113  services::Status setResult(const ResultPtr& result)
114  {
115  DAAL_CHECK(result, services::ErrorNullResult)
116  _result = result;
117  _res = _result.get();
118  return services::Status();
119  }
120 
125  ResultPtr getResult()
126  {
127  return _result;
128  }
129 
135  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
136  {
137  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
138  }
139 
140 protected:
141  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
142  {
143  return new Batch<algorithmFPType, method>(*this);
144  }
145 
146  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
147  {
148  services::Status s = _result->allocate<algorithmFPType>(&input, &parameter, 0);
149  _res = _result.get();
150  return s;
151  }
152 
153  void initialize()
154  {
155  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
156  _in = &input;
157  _par = &parameter;
158  _result.reset(new ResultType());
159  }
160 
161 public:
162  InputType input;
163  ParameterType parameter;
165 private:
166  ResultPtr _result;
167 };
169 } // namespace interface1
170 using interface1::BatchContainer;
171 using interface1::Batch;
172 
173 }; // namespace init
174 } // namespace em_gmm
175 } // namespace algorithm
176 } // namespace daal
177 #endif
daal::algorithms::em_gmm::init::interface1::Batch::getResult
ResultPtr getResult()
Definition: em_gmm_init_batch.h:125
daal::algorithms::em_gmm::init::interface1::Batch::parameter
ParameterType parameter
Definition: em_gmm_init_batch.h:163
daal::algorithms::em_gmm::init::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: em_gmm_init_batch.h:107
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::em_gmm::init::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: em_gmm_init_batch.h:98
daal_defines.h
daal::algorithms::em_gmm::init::interface1::Batch
Computes initial values for the EM for GMM algorithm in the batch processing mode.
Definition: em_gmm_init_batch.h:80
daal::batch
Definition: daal_defines.h:110
daal::algorithms::em_gmm::init::interface1::BatchContainer
Provides methods to compute initial values for the EM for GMM algorithm. The class is associated with...
Definition: em_gmm_init_batch.h:54
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::em_gmm::init::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: em_gmm_init_batch.h:113
daal::algorithms::em_gmm::init::interface1::Batch::input
InputType input
Definition: em_gmm_init_batch.h:162
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::em_gmm::init::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: em_gmm_init_batch.h:135

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