48 #ifndef __PCA_ONLINE_H__ 49 #define __PCA_ONLINE_H__ 51 #include "algorithms/algorithm.h" 52 #include "data_management/data/numeric_table.h" 53 #include "services/daal_defines.h" 54 #include "services/daal_memory.h" 55 #include "algorithms/pca/pca_types.h" 75 template<
typename algorithmFPType, Method method, CpuType cpu>
76 class DAAL_EXPORT OnlineContainer :
public AnalysisContainerIface<online> {};
82 template<
typename algorithmFPType, CpuType cpu>
83 class DAAL_EXPORT OnlineContainer<algorithmFPType, correlationDense, cpu> :
public AnalysisContainerIface<online>
91 OnlineContainer(daal::services::Environment::env *daalEnv);
98 services::Status compute() DAAL_C11_OVERRIDE;
102 services::Status finalizeCompute() DAAL_C11_OVERRIDE;
109 template<
typename algorithmFPType, CpuType cpu>
110 class DAAL_EXPORT OnlineContainer<algorithmFPType, svdDense, cpu> :
public AnalysisContainerIface<online>
118 OnlineContainer(daal::services::Environment::env *daalEnv);
125 services::Status compute() DAAL_C11_OVERRIDE;
129 services::Status finalizeCompute() DAAL_C11_OVERRIDE;
139 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = correlationDense>
140 class DAAL_EXPORT Online :
public Analysis<online> {};
149 template<
typename algorithmFPType>
150 class DAAL_EXPORT Online<algorithmFPType, correlationDense> :
public Analysis<online>
153 typedef algorithms::pca::Input InputType;
154 typedef algorithms::pca::OnlineParameter<algorithmFPType, correlationDense> ParameterType;
155 typedef algorithms::pca::Result ResultType;
156 typedef algorithms::pca::PartialResult<correlationDense> PartialResultType;
169 Online(
const Online<algorithmFPType, correlationDense> &other) : input(other.input), parameter(other.parameter)
180 int getMethod() const DAAL_C11_OVERRIDE {
return(
int)correlationDense; }
186 services::Status setPartialResult(
const services::SharedPtr<PartialResult<correlationDense> >& partialResult)
188 DAAL_CHECK(partialResult, services::ErrorNullPartialResult);
189 _partialResult = partialResult;
190 _pres = _partialResult.get();
191 return services::Status();
198 services::Status setResult(
const ResultPtr& res)
200 DAAL_CHECK(res, services::ErrorNullResult)
202 _res = _result.get();
203 return services::Status();
210 services::SharedPtr<PartialResult<correlationDense> > getPartialResult()
212 return _partialResult;
219 ResultPtr getResult()
229 services::SharedPtr<Online<algorithmFPType, correlationDense> > clone()
const 231 return services::SharedPtr<Online<algorithmFPType, correlationDense> >(cloneImpl());
235 OnlineParameter<algorithmFPType, correlationDense> parameter;
238 services::SharedPtr<PartialResult<correlationDense> > _partialResult;
241 virtual Online<algorithmFPType, correlationDense> * cloneImpl() const DAAL_C11_OVERRIDE
243 return new Online<algorithmFPType, correlationDense>(*this);
246 services::Status allocateResult() DAAL_C11_OVERRIDE
248 services::Status s = _result->allocate<algorithmFPType>(_pres, ¶meter, correlationDense);
249 _res = _result.get();
253 services::Status allocatePartialResult() DAAL_C11_OVERRIDE
255 services::Status s = _partialResult->allocate<algorithmFPType>(&input, ¶meter, correlationDense);
256 _pres = _partialResult.get();
260 services::Status initializePartialResult() DAAL_C11_OVERRIDE
262 services::Status s = _partialResult->initialize<algorithmFPType>(&input, ¶meter, correlationDense);
263 _pres = _partialResult.get();
269 _ac =
new __DAAL_ALGORITHM_CONTAINER(online, OnlineContainer, algorithmFPType, correlationDense)(&_env);
272 _partialResult.reset(
new PartialResult<correlationDense>());
273 _result.reset(
new ResultType());
284 template<
typename algorithmFPType>
285 class DAAL_EXPORT Online<algorithmFPType, svdDense> :
public Analysis<online>
288 typedef algorithms::pca::Input InputType;
289 typedef algorithms::pca::OnlineParameter<algorithmFPType, svdDense> ParameterType;
290 typedef algorithms::pca::Result ResultType;
291 typedef algorithms::pca::PartialResult<svdDense> PartialResultType;
304 Online(
const Online<algorithmFPType, svdDense> &other) : input(other.input), parameter(other.parameter)
315 int getMethod() const DAAL_C11_OVERRIDE {
return(
int)svdDense; }
321 services::Status setPartialResult(
const services::SharedPtr<PartialResult<svdDense> >& partialResult)
323 DAAL_CHECK(partialResult, services::ErrorNullPartialResult);
324 _partialResult = partialResult;
325 _pres = _partialResult.get();
326 return services::Status();
333 services::Status setResult(
const ResultPtr& res)
335 DAAL_CHECK(res, services::ErrorNullResult)
337 _res = _result.get();
338 return services::Status();
345 services::SharedPtr<PartialResult<svdDense> > getPartialResult()
347 return _partialResult;
354 ResultPtr getResult()
364 services::SharedPtr<Online<algorithmFPType, svdDense> > clone()
const 366 return services::SharedPtr<Online<algorithmFPType, svdDense> >(cloneImpl());
370 OnlineParameter<algorithmFPType, svdDense> parameter;
373 services::SharedPtr<PartialResult<svdDense> > _partialResult;
376 virtual Online<algorithmFPType, svdDense> * cloneImpl() const DAAL_C11_OVERRIDE
378 return new Online<algorithmFPType, svdDense>(*this);
381 services::Status allocateResult() DAAL_C11_OVERRIDE
383 services::Status s = _result->allocate<algorithmFPType>(_pres, ¶meter, svdDense);
384 _res = _result.get();
388 services::Status allocatePartialResult() DAAL_C11_OVERRIDE
390 services::Status s = _partialResult->allocate<algorithmFPType>(&input, ¶meter, svdDense);
391 _pres = _partialResult.get();
395 services::Status initializePartialResult() DAAL_C11_OVERRIDE
397 services::Status s = _partialResult->initialize<algorithmFPType>(&input, ¶meter, svdDense);
398 _pres = _partialResult.get();
404 _ac =
new __DAAL_ALGORITHM_CONTAINER(online, OnlineContainer, algorithmFPType, svdDense)(&_env);
407 _partialResult.reset(
new PartialResult<svdDense>());
408 _result.reset(
new ResultType());
413 using interface1::OnlineContainer;
414 using interface1::Online;
daal::algorithms::pca::interface1::OnlineParameter< algorithmFPType, correlationDense >
Class that specifies the parameters of the PCA Correlation algorithm in the online computing mode...
Definition: pca_types.h:498
daal::services::interface1::Environment::_envStruct
The environment structure.
Definition: env_detect.h:95
daal::services::interface1::Status
Class that holds the results of API calls. In case of API routine failure it contains the list of err...
Definition: error_handling.h:491
daal
Definition: algorithm_base_common.h:57
daal::algorithms::pca::interface1::Online
Computes the results of the PCA algorithm.
Definition: pca_online.h:140
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:79
daal::algorithms::pca::interface1::Online< algorithmFPType, correlationDense >::getMethod
int getMethod() const DAAL_C11_OVERRIDE
Definition: pca_online.h:180
daal::algorithms::pca::interface1::Online< algorithmFPType, svdDense >::setPartialResult
services::Status setPartialResult(const services::SharedPtr< PartialResult< svdDense > > &partialResult)
Definition: pca_online.h:321
daal::algorithms::pca::interface1::Online< algorithmFPType, svdDense >
Computes the results of the PCA SVD algorithm.
Definition: pca_online.h:285
daal::services::ErrorNullPartialResult
Definition: error_indexes.h:131
daal::algorithms::pca::interface1::OnlineContainer
Class containing methods to compute the result of the PCA algorithm.
Definition: pca_online.h:76
daal::algorithms::pca::interface1::Online< algorithmFPType, svdDense >::setResult
services::Status setResult(const ResultPtr &res)
Definition: pca_online.h:333
daal::algorithms::pca::interface1::Online< algorithmFPType, svdDense >::Online
Online()
Definition: pca_online.h:294
daal::algorithms::pca::interface1::Online< algorithmFPType, svdDense >::getPartialResult
services::SharedPtr< PartialResult< svdDense > > getPartialResult()
Definition: pca_online.h:345
daal::algorithms::pca::interface1::Online< algorithmFPType, correlationDense >::clone
services::SharedPtr< Online< algorithmFPType, correlationDense > > clone() const
Definition: pca_online.h:229
daal::algorithms::pca::interface1::Online< algorithmFPType, correlationDense >::parameter
OnlineParameter< algorithmFPType, correlationDense > parameter
Definition: pca_online.h:235
daal::algorithms::pca::interface1::Online< algorithmFPType, correlationDense >::input
InputType input
Definition: pca_online.h:234
daal::algorithms::pca::interface1::Online< algorithmFPType, svdDense >::input
InputType input
Definition: pca_online.h:369
daal::algorithms::pca::interface1::Online< algorithmFPType, svdDense >::getMethod
int getMethod() const DAAL_C11_OVERRIDE
Definition: pca_online.h:315
daal::algorithms::pca::interface1::Online< algorithmFPType, correlationDense >::setResult
services::Status setResult(const ResultPtr &res)
Definition: pca_online.h:198
daal::services::interface1::SharedPtr
Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr object...
Definition: daal_shared_ptr.h:187
daal::algorithms::pca::interface2::Result
Provides methods to access results obtained with the PCA algorithm.
Definition: pca_types.h:753
daal::algorithms::pca::interface1::Online< algorithmFPType, correlationDense >::getPartialResult
services::SharedPtr< PartialResult< correlationDense > > getPartialResult()
Definition: pca_online.h:210
daal::algorithms::pca::interface1::OnlineParameter
Class that specifies the parameters of the PCA algorithm in the online computing mode.
Definition: pca_types.h:491
daal::algorithms::pca::interface1::PartialResult
Provides methods to access partial results obtained with the compute() method of the PCA algorithm in...
Definition: pca_types.h:287
daal::services::interface1::SharedPtr::get
T * get() const
Definition: daal_shared_ptr.h:332
daal::algorithms::pca::interface1::Online< algorithmFPType, correlationDense >
Computes the results of the PCA Correlation algorithm.
Definition: pca_online.h:150
daal::algorithms::pca::svdDense
Definition: pca_types.h:83
daal::services::interface1::SharedPtr::reset
void reset()
Definition: daal_shared_ptr.h:265
daal::algorithms::pca::interface1::Online< algorithmFPType, svdDense >::parameter
OnlineParameter< algorithmFPType, svdDense > parameter
Definition: pca_online.h:370
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:94
daal::algorithms::pca::interface1::Online< algorithmFPType, correlationDense >::Online
Online(const Online< algorithmFPType, correlationDense > &other)
Definition: pca_online.h:169
daal::algorithms::pca::interface1::Online< algorithmFPType, correlationDense >::Online
Online()
Definition: pca_online.h:159
daal::algorithms::pca::interface1::Online< algorithmFPType, svdDense >::clone
services::SharedPtr< Online< algorithmFPType, svdDense > > clone() const
Definition: pca_online.h:364
daal::online
Definition: daal_defines.h:134
daal::algorithms::pca::interface1::Online< algorithmFPType, correlationDense >::setPartialResult
services::Status setPartialResult(const services::SharedPtr< PartialResult< correlationDense > > &partialResult)
Definition: pca_online.h:186
daal::algorithms::pca::interface1::Online< algorithmFPType, svdDense >::Online
Online(const Online< algorithmFPType, svdDense > &other)
Definition: pca_online.h:304
daal::services::ErrorNullResult
Definition: error_indexes.h:122
daal::algorithms::pca::interface1::OnlineParameter< algorithmFPType, svdDense >
Class that specifies the parameters of the PCA SVD algorithm in the online computing mode...
Definition: pca_types.h:521
daal::algorithms::pca::correlationDense
Definition: pca_types.h:81