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

correlation_distance.h
1 /* file: correlation_distance.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 for the correlation distance algorithm
19 // in the batch processing mode
20 //--
21 */
22 
23 #ifndef __CORDISTANCE_H__
24 #define __CORDISTANCE_H__
25 
26 #include "algorithms/algorithm.h"
27 #include "data_management/data/numeric_table.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/distance/correlation_distance_types.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
35 namespace correlation_distance
36 {
37 
38 namespace interface1
39 {
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);
64  ~BatchContainer();
68  virtual services::Status compute() DAAL_C11_OVERRIDE;
69 };
70 
84 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
85 class DAAL_EXPORT Batch : public daal::algorithms::Analysis<batch>
86 {
87 public:
88  typedef algorithms::correlation_distance::Input InputType;
89  typedef algorithms::correlation_distance::Result ResultType;
90 
91  Batch()
92  {
93  initialize();
94  }
95 
102  Batch(const Batch<algorithmFPType, method> &other) : input(other.input)
103  {
104  initialize();
105  }
106 
111  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
112 
117  ResultPtr getResult()
118  {
119  return _result;
120  }
121 
126  services::Status setResult(const ResultPtr& res)
127  {
128  DAAL_CHECK(res, services::ErrorNullResult)
129  _result = res;
130  _res = _result.get();
131  return services::Status();
132  }
133 
139  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
140  {
141  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
142  }
143 
144 protected:
145  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
146  {
147  return new Batch<algorithmFPType, method>(*this);
148  }
149 
150  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
151  {
152  services::Status s = _result->allocate<algorithmFPType>(&input, NULL, (int) method);
153  _res = _result.get();
154  return s;
155  }
156 
157  void initialize()
158  {
159  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
160  _in = &input;
161  _result.reset(new ResultType());
162  }
163 
164 public:
165  InputType input;
167 private:
168  ResultPtr _result;
169 };
171 } // namespace interface1
172 using interface1::BatchContainer;
173 using interface1::Batch;
174 
175 } // namespace correlation_distance
176 } // namespace algorithms
177 } // namespace daal
178 #endif
daal::algorithms::correlation_distance::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: correlation_distance.h:111
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::correlation_distance::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: correlation_distance.h:102
daal::algorithms::correlation_distance::interface1::BatchContainer
Provides methods to run implementations of the correlation distance algorithm. This class is associat...
Definition: correlation_distance.h:54
daal_defines.h
daal::batch
Definition: daal_defines.h:110
daal::algorithms::correlation_distance::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: correlation_distance.h:139
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::correlation_distance::interface1::Batch::setResult
services::Status setResult(const ResultPtr &res)
Definition: correlation_distance.h:126
daal::algorithms::correlation_distance::interface1::Batch::input
InputType input
Definition: correlation_distance.h:165
daal::algorithms::correlation_distance::interface1::Batch::getResult
ResultPtr getResult()
Definition: correlation_distance.h:117
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::correlation_distance::interface1::Batch
Computes the correlation distance in the batch processing mode.
Definition: correlation_distance.h:85

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