49 #ifndef __PCA_DISTRIBUTED_H__
50 #define __PCA_DISTRIBUTED_H__
52 #include "algorithms/algorithm.h"
53 #include "data_management/data/numeric_table.h"
54 #include "services/daal_defines.h"
55 #include "services/daal_memory.h"
56 #include "algorithms/pca/pca_types.h"
57 #include "algorithms/pca/pca_online.h"
77 template<ComputeStep computeStep,
typename algorithmFPType, Method method, CpuType cpu>
78 class DAAL_EXPORT DistributedContainer
85 template<
typename algorithmFPType, CpuType cpu>
86 class DAAL_EXPORT DistributedContainer<step1Local, algorithmFPType, correlationDense, cpu> :
public
87 OnlineContainer<algorithmFPType, correlationDense, cpu>
91 DistributedContainer(daal::services::Environment::env *daalEnv) : OnlineContainer<algorithmFPType, correlationDense, cpu>(daalEnv) {};
92 virtual ~DistributedContainer() {}
99 template<
typename algorithmFPType, CpuType cpu>
100 class DAAL_EXPORT DistributedContainer<step2Master, algorithmFPType, correlationDense, cpu> :
public AnalysisContainerIface<distributed>
108 DistributedContainer(daal::services::Environment::env *daalEnv);
110 virtual ~DistributedContainer();
116 services::Status compute() DAAL_C11_OVERRIDE;
121 services::Status finalizeCompute() DAAL_C11_OVERRIDE;
129 template<
typename algorithmFPType, CpuType cpu>
130 class DAAL_EXPORT DistributedContainer<step1Local, algorithmFPType, svdDense, cpu> :
public OnlineContainer<algorithmFPType, svdDense, cpu>
134 DistributedContainer(daal::services::Environment::env *daalEnv) : OnlineContainer<algorithmFPType, svdDense, cpu>(daalEnv) {};
135 virtual ~DistributedContainer() {}
142 template<
typename algorithmFPType, CpuType cpu>
143 class DAAL_EXPORT DistributedContainer<step2Master, algorithmFPType, svdDense, cpu> :
public AnalysisContainerIface<distributed>
151 DistributedContainer(daal::services::Environment::env *daalEnv);
153 ~DistributedContainer();
159 services::Status compute() DAAL_C11_OVERRIDE;
164 services::Status finalizeCompute() DAAL_C11_OVERRIDE;
181 template<ComputeStep computeStep,
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = correlationDense>
182 class DAAL_EXPORT Distributed :
public Analysis<distributed> {};
198 template<
typename algorithmFPType, Method method>
199 class DAAL_EXPORT Distributed<step1Local, algorithmFPType, method> :
public Online<algorithmFPType, method>
203 Distributed() : Online<algorithmFPType, method>() {}
210 Distributed(
const Distributed<step1Local, algorithmFPType, method> &other) :
211 Online<algorithmFPType, method>(other)
219 services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone()
const
221 return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
225 virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
227 return new Distributed<step1Local, algorithmFPType, method>(*this);
238 template<
typename algorithmFPType>
239 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, correlationDense> :
public Analysis<distributed>
253 Distributed(
const Distributed<step2Master, algorithmFPType, correlationDense> &other) :
254 input(other.input), parameter(other.parameter)
265 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)correlationDense; }
271 services::Status setPartialResult(
const services::SharedPtr<PartialResult<correlationDense> >& partialResult)
273 DAAL_CHECK(partialResult, services::ErrorNullPartialResult);
274 _partialResult = partialResult;
275 _pres = _partialResult.get();
276 return services::Status();
283 services::SharedPtr<PartialResult<correlationDense> > getPartialResult()
285 _partialResult->set(sumCorrelation, parameter.covariance->getPartialResult()->get(covariance::sum));
286 _partialResult->set(nObservationsCorrelation, parameter.covariance->getPartialResult()->get(covariance::nObservations));
287 _partialResult->set(crossProductCorrelation, parameter.covariance->getPartialResult()->get(covariance::crossProduct));
288 return _partialResult;
295 services::Status setResult(
const ResultPtr& res)
297 DAAL_CHECK(res, services::ErrorNullResult)
299 _res = _result.get();
300 return services::Status();
307 ResultPtr getResult()
317 services::SharedPtr<Distributed<step2Master, algorithmFPType, correlationDense> > clone()
const
319 return services::SharedPtr<Distributed<step2Master, algorithmFPType, correlationDense> >(cloneImpl());
322 DistributedInput<correlationDense> input;
323 DistributedParameter<step2Master, algorithmFPType, correlationDense> parameter;
326 services::SharedPtr<PartialResult<correlationDense> > _partialResult;
329 virtual Distributed<step2Master, algorithmFPType, correlationDense> * cloneImpl() const DAAL_C11_OVERRIDE
331 return new Distributed<step2Master, algorithmFPType, correlationDense>(*this);
334 services::Status allocateResult() DAAL_C11_OVERRIDE
336 services::Status s =_result->allocate<algorithmFPType>(_pres, ¶meter, correlationDense);
337 _res = _result.get();
341 services::Status allocatePartialResult() DAAL_C11_OVERRIDE
343 services::Status s = _partialResult->allocate<algorithmFPType>(&input, ¶meter, correlationDense);
344 _pres = _partialResult.get();
348 services::Status initializePartialResult() DAAL_C11_OVERRIDE {
return services::Status(); }
352 _ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, correlationDense)(&_env);
355 _partialResult.reset(
new PartialResult<correlationDense>());
356 _result.reset(
new Result());
367 template<
typename algorithmFPType>
368 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, svdDense> :
public Analysis<distributed>
382 Distributed(
const Distributed<step2Master, algorithmFPType, svdDense> &other) :
383 input(other.input), parameter(other.parameter)
394 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)svdDense; }
400 services::Status setPartialResult(
const services::SharedPtr<PartialResult<svdDense> >& partialResult)
402 DAAL_CHECK(partialResult, services::ErrorNullPartialResult);
403 _partialResult = partialResult;
404 _pres = _partialResult.get();
405 return services::Status();
412 services::SharedPtr<PartialResult<svdDense> > getPartialResult()
414 return _partialResult;
421 services::Status setResult(
const ResultPtr& res)
423 DAAL_CHECK(res, services::ErrorNullResult)
425 _res = _result.get();
426 return services::Status();
433 ResultPtr getResult()
443 services::SharedPtr<Distributed<step2Master, algorithmFPType, svdDense> > clone()
const
445 return services::SharedPtr<Distributed<step2Master, algorithmFPType, svdDense> >(cloneImpl());
448 DistributedInput<svdDense> input;
449 DistributedParameter<step2Master, algorithmFPType, svdDense> parameter;
452 services::SharedPtr<PartialResult<svdDense> > _partialResult;
455 virtual Distributed<step2Master, algorithmFPType, svdDense> * cloneImpl() const DAAL_C11_OVERRIDE
457 return new Distributed<step2Master, algorithmFPType, svdDense>(*this);
460 services::Status allocateResult() DAAL_C11_OVERRIDE
462 services::Status s = _result->allocate<algorithmFPType>(_pres, ¶meter, svdDense);
463 _res = _result.get();
467 services::Status allocatePartialResult() DAAL_C11_OVERRIDE
469 services::Status s = _partialResult->allocate<algorithmFPType>(&input, ¶meter, svdDense);
470 _pres = _partialResult.get();
473 services::Status initializePartialResult() DAAL_C11_OVERRIDE{
return services::Status(); }
477 _ac =
new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, svdDense)(&_env);
480 _partialResult.reset(
new PartialResult<svdDense>());
481 _result.reset(
new Result());
486 using interface1::DistributedContainer;
487 using interface1::Distributed;
daal::algorithms::pca::interface1::DistributedParameter< step2Master, algorithmFPType, svdDense >
daal::algorithms::pca::interface1::Distributed< step1Local, algorithmFPType, method >
Computes the results of the PCA algorithm on the local nodes.
Definition: pca_distributed.h:199
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, correlationDense >::Distributed
Distributed()
Definition: pca_distributed.h:243
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, svdDense >::input
DistributedInput< svdDense > input
Definition: pca_distributed.h:448
daal::algorithms::covariance::crossProduct
Definition: covariance_types.h:103
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, correlationDense >::Distributed
Distributed(const Distributed< step2Master, algorithmFPType, correlationDense > &other)
Definition: pca_distributed.h:253
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::Distributed< step2Master, algorithmFPType, svdDense >::getResult
ResultPtr getResult()
Definition: pca_distributed.h:433
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::Distributed< step2Master, algorithmFPType, svdDense >::setResult
services::Status setResult(const ResultPtr &res)
Definition: pca_distributed.h:421
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, correlationDense >
Computes the result of the PCA Correlation algorithm on local nodes.
Definition: pca_distributed.h:239
daal::algorithms::kmeans::init::interface1::Distributed
class DAAL_EXPORT Distributed
Computes initial clusters for the K-Means algorithm in the distributed processing mode...
Definition: kmeans_init_distributed.h:281
daal::distributed
Definition: daal_defines.h:132
daal::algorithms::covariance::sum
Definition: covariance_types.h:104
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::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, svdDense >::getPartialResult
services::SharedPtr< PartialResult< svdDense > > getPartialResult()
Definition: pca_distributed.h:412
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, correlationDense >::input
DistributedInput< correlationDense > input
Definition: pca_distributed.h:322
daal::algorithms::pca::svdDense
Definition: pca_types.h:83
daal::algorithms::pca::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: pca_distributed.h:210
daal::algorithms::pca::interface1::Distributed< step1Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step1Local, algorithmFPType, method > > clone() const
Definition: pca_distributed.h:219
daal::algorithms::pca::interface1::DistributedContainer
Class containing methods to compute the results of the PCA algorithm in the distributed processing mo...
Definition: pca_distributed.h:78
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, svdDense >::Distributed
Distributed()
Definition: pca_distributed.h:372
daal::algorithms::pca::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed()
Definition: pca_distributed.h:203
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, svdDense >::Distributed
Distributed(const Distributed< step2Master, algorithmFPType, svdDense > &other)
Definition: pca_distributed.h:382
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::Distributed< step2Master, algorithmFPType, correlationDense >::parameter
DistributedParameter< step2Master, algorithmFPType, correlationDense > parameter
Definition: pca_distributed.h:323
daal::algorithms::kmeans::interface1::DistributedContainer
class DAAL_EXPORT DistributedContainer
Provides methods to run implementations of the K-Means algorithm. This class is associated with the d...
Definition: kmeans_distributed.h:81
daal::step1Local
Definition: daal_defines.h:142
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, svdDense >
Computes the result of the PCA SVD algorithm on local nodes.
Definition: pca_distributed.h:368
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, svdDense >::setPartialResult
services::Status setPartialResult(const services::SharedPtr< PartialResult< svdDense > > &partialResult)
Definition: pca_distributed.h:400
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, correlationDense >::setResult
services::Status setResult(const ResultPtr &res)
Definition: pca_distributed.h:295
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, correlationDense >::getPartialResult
services::SharedPtr< PartialResult< correlationDense > > getPartialResult()
Definition: pca_distributed.h:283
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, correlationDense >::setPartialResult
services::Status setPartialResult(const services::SharedPtr< PartialResult< correlationDense > > &partialResult)
Definition: pca_distributed.h:271
daal::step2Master
Definition: daal_defines.h:143
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, svdDense >::clone
services::SharedPtr< Distributed< step2Master, algorithmFPType, svdDense > > clone() const
Definition: pca_distributed.h:443
daal::algorithms::pca::interface1::DistributedContainer< step1Local, algorithmFPType, correlationDense, cpu >::DistributedContainer
DistributedContainer(daal::services::Environment::env *daalEnv)
Constructor.
Definition: pca_distributed.h:91
daal::algorithms::covariance::nObservations
Definition: covariance_types.h:102
daal::algorithms::pca::interface1::DistributedParameter< step2Master, algorithmFPType, correlationDense >
Class that specifies the parameters of the PCA Correlation algorithm in the distributed computing mod...
Definition: pca_types.h:546
daal::algorithms::pca::interface1::DistributedContainer< step1Local, algorithmFPType, svdDense, cpu >::DistributedContainer
DistributedContainer(daal::services::Environment::env *daalEnv)
Constructor.
Definition: pca_distributed.h:134
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, correlationDense >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: pca_distributed.h:265
daal::services::ErrorNullResult
Definition: error_indexes.h:122
daal::algorithms::pca::interface1::Distributed
Computes the result of the PCA algorithm.
Definition: pca_distributed.h:182
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, svdDense >::parameter
DistributedParameter< step2Master, algorithmFPType, svdDense > parameter
Definition: pca_distributed.h:449
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, svdDense >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: pca_distributed.h:394
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, correlationDense >::clone
services::SharedPtr< Distributed< step2Master, algorithmFPType, correlationDense > > clone() const
Definition: pca_distributed.h:317
daal::algorithms::pca::correlationDense
Definition: pca_types.h:81
daal::algorithms::pca::interface1::Distributed< step2Master, algorithmFPType, correlationDense >::getResult
ResultPtr getResult()
Definition: pca_distributed.h:307