C++ API Reference for Intel® Data Analytics Acceleration Library 2018 Update 2

kmeans_init_distributed.h
1 /* file: kmeans_init_distributed.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of the interface for initializing the K-Means algorithm
45 // in the distributed processing mode
46 //--
47 */
48 
49 #ifndef __KMEANS_INIT_DISTRIBITED_H__
50 #define __KMEANS_INIT_DISTRIBITED_H__
51 
52 #include "algorithms/algorithm.h"
53 #include "data_management/data/numeric_table.h"
54 #include "services/daal_defines.h"
55 #include "algorithms/kmeans/kmeans_init_types.h"
56 
57 namespace daal
58 {
59 namespace algorithms
60 {
61 namespace kmeans
62 {
63 namespace init
64 {
65 
66 namespace interface1
67 {
82 template<ComputeStep step, typename algorithmFPType, Method method, CpuType cpu>
83 class DAAL_EXPORT DistributedContainer;
84 
89 template<typename algorithmFPType, Method method, CpuType cpu>
90 class DAAL_EXPORT DistributedContainer<step1Local, algorithmFPType, method, cpu> : public
91  daal::algorithms::AnalysisContainerIface<distributed>
92 {
93 public:
99  DistributedContainer(daal::services::Environment::env *daalEnv);
101  virtual ~DistributedContainer();
106  virtual services::Status compute() DAAL_C11_OVERRIDE;
111  virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
112 };
113 
118 template<typename algorithmFPType, Method method, CpuType cpu>
119 class DAAL_EXPORT DistributedContainer<step2Master, algorithmFPType, method, cpu> : public
120  daal::algorithms::AnalysisContainerIface<distributed>
121 {
122 public:
128  DistributedContainer(daal::services::Environment::env *daalEnv);
130  virtual ~DistributedContainer();
135  virtual services::Status compute() DAAL_C11_OVERRIDE;
140  virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
141 };
142 
148 template<typename algorithmFPType, Method method, CpuType cpu>
149 class DAAL_EXPORT DistributedContainer<step2Local, algorithmFPType, method, cpu> : public
150  daal::algorithms::AnalysisContainerIface<distributed>
151 {
152 public:
158  DistributedContainer(daal::services::Environment::env *daalEnv);
160  virtual ~DistributedContainer();
165  virtual services::Status compute() DAAL_C11_OVERRIDE;
170  virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
171 };
172 
178 template<typename algorithmFPType, Method method, CpuType cpu>
179 class DAAL_EXPORT DistributedContainer<step3Master, algorithmFPType, method, cpu> : public
180  daal::algorithms::AnalysisContainerIface<distributed>
181 {
182 public:
188  DistributedContainer(daal::services::Environment::env *daalEnv);
190  virtual ~DistributedContainer();
195  virtual services::Status compute() DAAL_C11_OVERRIDE;
200  virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
201 };
202 
208 template<typename algorithmFPType, Method method, CpuType cpu>
209 class DAAL_EXPORT DistributedContainer<step4Local, algorithmFPType, method, cpu> : public
210  daal::algorithms::AnalysisContainerIface<distributed>
211 {
212 public:
218  DistributedContainer(daal::services::Environment::env *daalEnv);
220  virtual ~DistributedContainer();
225  virtual services::Status compute() DAAL_C11_OVERRIDE;
230  virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
231 };
232 
238 template<typename algorithmFPType, Method method, CpuType cpu>
239 class DAAL_EXPORT DistributedContainer<step5Master, algorithmFPType, method, cpu> : public
240  daal::algorithms::AnalysisContainerIface<distributed>
241 {
242 public:
248  DistributedContainer(daal::services::Environment::env *daalEnv);
250  virtual ~DistributedContainer();
255  virtual services::Status compute() DAAL_C11_OVERRIDE;
260  virtual services::Status finalizeCompute() DAAL_C11_OVERRIDE;
261 };
262 
280 template<ComputeStep step, typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
281 class DAAL_EXPORT Distributed;
282 
300 template<typename algorithmFPType, Method method>
301 class DAAL_EXPORT Distributed<step1Local, algorithmFPType, method> : public daal::algorithms::Analysis<distributed>
302 {
303 public:
304  typedef algorithms::kmeans::init::Input InputType;
305  typedef algorithms::kmeans::init::Parameter ParameterType;
306  typedef algorithms::kmeans::init::Result ResultType;
307  typedef algorithms::kmeans::init::PartialResult PartialResultType;
308 
315  Distributed(size_t nClusters, size_t nRowsTotal, size_t offset = 0) : parameter(nClusters, offset)
316  {
317  initialize();
318  parameter.nRowsTotal = nRowsTotal;
319  }
320 
326  Distributed(const Distributed<step1Local, algorithmFPType, method> &other) : parameter(other.parameter)
327  {
328  initialize();
329  input.set(data, other.input.get(data));
330  }
331 
336  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int) method; }
337 
342  ResultPtr getResult()
343  {
344  return _result;
345  }
346 
351  services::Status setResult(const ResultPtr& result)
352  {
353  DAAL_CHECK(result, services::ErrorNullResult)
354  _result = result;
355  _res = _result.get();
356  return services::Status();
357  }
358 
363  PartialResultPtr getPartialResult()
364  {
365  return _partialResult;
366  }
367 
372  services::Status setPartialResult(const PartialResultPtr& partialRes)
373  {
374  DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
375  _partialResult = partialRes;
376  _pres = _partialResult.get();
377  return services::Status();
378  }
379 
383  services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
384  {
385  return services::Status();
386  }
387 
393  services::SharedPtr<Distributed<step1Local, algorithmFPType, method> > clone() const
394  {
395  return services::SharedPtr<Distributed<step1Local, algorithmFPType, method> >(cloneImpl());
396  }
397 
398 protected:
399  virtual Distributed<step1Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
400  {
401  return new Distributed<step1Local, algorithmFPType, method>(*this);
402  }
403 
404  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
405  {
406  _result.reset(new ResultType());
407  services::Status s = _result->allocate<algorithmFPType>(_pres, _par, (int) method);
408  _res = _result.get();
409  return s;
410  }
411 
412  virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
413  {
414  _partialResult.reset(new PartialResultType());
415  services::Status s = _partialResult->allocate<algorithmFPType>(&input, _par, (int) method);
416  _pres = _partialResult.get();
417  return s;
418  }
419 
420  virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
421  {
422  return services::Status();
423  }
424 
425  void initialize()
426  {
427  Analysis<distributed>::_ac = new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step1Local, algorithmFPType, method)(&_env);
428  _in = &input;
429  _par = &parameter;
430  }
431 
432 public:
433  InputType input;
434  ParameterType parameter;
436 private:
437  PartialResultPtr _partialResult;
438  ResultPtr _result;
439 };
440 
458 template<typename algorithmFPType, Method method>
459 class DAAL_EXPORT Distributed<step2Master, algorithmFPType, method>: public daal::algorithms::Analysis<distributed>
460 {
461 public:
462  typedef algorithms::kmeans::init::DistributedStep2MasterInput InputType;
463  typedef algorithms::kmeans::init::Parameter ParameterType;
464  typedef algorithms::kmeans::init::Result ResultType;
465  typedef algorithms::kmeans::init::PartialResult PartialResultType;
466 
472  Distributed(size_t nClusters, size_t offset = 0) : parameter(nClusters, offset)
473  {
474  Analysis<distributed>::_ac = new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
475  _in = &input;
476  _par = &parameter;
477  }
478 
483  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int) method; }
484 
489  ResultPtr getResult()
490  {
491  return _result;
492  }
493 
497  services::Status setResult(const ResultPtr& result)
498  {
499  DAAL_CHECK(result, services::ErrorNullResult)
500  _result = result;
501  _res = _result.get();
502  return services::Status();
503  }
504 
509  PartialResultPtr getPartialResult()
510  {
511  return _partialResult;
512  }
513 
518  services::Status setPartialResult(const PartialResultPtr& partialRes)
519  {
520  DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
521  _partialResult = partialRes;
522  _pres = _partialResult.get();
523  return services::Status();
524  }
525 
529  services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
530  {
531  services::Status s;
532  if(_partialResult)
533  {
534  s |= _partialResult->check(_par, method);
535  if (!s) { return s; }
536  }
537  else
538  {
539  return services::Status(services::ErrorNullResult);
540  }
541 
542  if(_result)
543  {
544  s |= _result->check(&input, _par, method);
545  }
546  else
547  {
548  return services::Status(services::ErrorNullResult);
549  }
550  return s;
551  }
552 
558  services::SharedPtr<Distributed<step2Master, algorithmFPType, method> > clone() const
559  {
560  return services::SharedPtr<Distributed<step2Master, algorithmFPType, method> >(cloneImpl());
561  }
562 
563 protected:
564  virtual Distributed<step2Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
565  {
566  return new Distributed<step2Master, algorithmFPType, method>(*this);
567  }
568 
569  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
570  {
571  _result.reset(new ResultType());
572  services::Status s = _result->allocate<algorithmFPType>(_pres, _par, (int)method);
573  _res = _result.get();
574  return s;
575  }
576 
577  virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
578  {
579  _partialResult.reset(new PartialResultType());
580  services::Status s = _partialResult->allocate<algorithmFPType>(&input, _par, (int)method);
581  if(!s) return s;
582  _pres = _partialResult.get();
583  if(!_res)
584  {
585  _result.reset(new ResultType());
586  s |= _result->allocate<algorithmFPType>(&input, _par, (int)method);
587  _res = _result.get();
588  }
589  return s;
590  }
591 
592  virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
593  {
594  return services::Status();
595  }
596 
597  void initialize()
598  {
599  Analysis<distributed>::_ac = new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Master, algorithmFPType, method)(&_env);
600  _in = &input;
601  _par = &parameter;
602  }
603 
604 public:
605  InputType input;
606  ParameterType parameter;
608 private:
609  PartialResultPtr _partialResult;
610  ResultPtr _result;
611 };
612 
634 template<typename algorithmFPType, Method method>
635 class DAAL_EXPORT Distributed<step2Local, algorithmFPType, method> : public daal::algorithms::Analysis<distributed>
636 {
637 public:
638  typedef algorithms::kmeans::init::DistributedStep2LocalPlusPlusInput InputType;
639  typedef algorithms::kmeans::init::DistributedStep2LocalPlusPlusParameter ParameterType;
640  typedef algorithms::kmeans::init::DistributedStep2LocalPlusPlusPartialResult PartialResultType;
641 
647  Distributed(size_t nClusters, bool bFirstIteration) : parameter(nClusters, bFirstIteration)
648  {
649  initialize();
650  }
651 
657  Distributed(const Distributed<step2Local, algorithmFPType, method> &other) : parameter(other.parameter), input(other.input)
658  {
659  initialize();
660  }
661 
666  virtual int getMethod() const DAAL_C11_OVERRIDE{ return(int)method; }
667 
672  DistributedStep2LocalPlusPlusPartialResultPtr getPartialResult()
673  {
674  return _partialResult;
675  }
676 
681  services::Status setPartialResult(const DistributedStep2LocalPlusPlusPartialResultPtr& partialRes)
682  {
683  DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
684  _partialResult = partialRes;
685  _pres = _partialResult.get();
686  return services::Status();
687  }
688 
692  services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
693  {
694  return services::Status();
695  }
696 
702  services::SharedPtr<Distributed<step2Local, algorithmFPType, method> > clone() const
703  {
704  return services::SharedPtr<Distributed<step2Local, algorithmFPType, method> >(cloneImpl());
705  }
706 
707 protected:
708  virtual Distributed<step2Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
709  {
710  return new Distributed<step2Local, algorithmFPType, method>(*this);
711  }
712 
713  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
714  {
715  return services::Status();
716  }
717 
718  virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
719  {
720  _partialResult.reset(new DistributedStep2LocalPlusPlusPartialResult());
721  services::Status s = _partialResult->allocate<algorithmFPType>(&input, _par, (int)method);
722  _pres = _partialResult.get();
723  return s;
724  }
725 
726  virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
727  {
728  _partialResult->initialize(&input, _par, (int)method);
729  return services::Status();
730  }
731 
732  void initialize()
733  {
734  Analysis<distributed>::_ac = new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step2Local, algorithmFPType, method)(&_env);
735  _in = &input;
736  _par = &parameter;
737  }
738 
739 public:
740  InputType input;
741  ParameterType parameter;
743 private:
744  DistributedStep2LocalPlusPlusPartialResultPtr _partialResult;
745 };
746 
767 template<typename algorithmFPType, Method method>
768 class DAAL_EXPORT Distributed<step3Master, algorithmFPType, method> : public daal::algorithms::Analysis<distributed>
769 {
770 public:
771  typedef algorithms::kmeans::init::DistributedStep3MasterPlusPlusInput InputType;
772  typedef algorithms::kmeans::init::Parameter ParameterType;
773  typedef algorithms::kmeans::init::DistributedStep3MasterPlusPlusPartialResult PartialResultType;
774 
779  Distributed(size_t nClusters) : parameter(nClusters)
780  {
781  initialize();
782  }
783 
789  Distributed(const Distributed<step3Master, algorithmFPType, method> &other) : parameter(other.parameter), input(other.input)
790  {
791  initialize();
792  }
793 
798  virtual int getMethod() const DAAL_C11_OVERRIDE{ return(int)method; }
799 
804  DistributedStep3MasterPlusPlusPartialResultPtr getPartialResult()
805  {
806  return _partialResult;
807  }
808 
813  services::Status setPartialResult(const DistributedStep3MasterPlusPlusPartialResultPtr& partialRes)
814  {
815  DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
816  _partialResult = partialRes;
817  _pres = _partialResult.get();
818  return services::Status();
819  }
820 
824  services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
825  {
826  return services::Status();
827  }
828 
834  services::SharedPtr<Distributed<step3Master, algorithmFPType, method> > clone() const
835  {
836  return services::SharedPtr<Distributed<step3Master, algorithmFPType, method> >(cloneImpl());
837  }
838 
839 protected:
840  virtual Distributed<step3Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
841  {
842  return new Distributed<step3Master, algorithmFPType, method>(*this);
843  }
844 
845  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
846  {
847  return services::Status();
848  }
849 
850  virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
851  {
852  _partialResult.reset(new PartialResultType());
853  services::Status s = _partialResult->allocate<algorithmFPType>(&input, _par, (int)method);
854  _pres = _partialResult.get();
855  return s;
856  }
857 
858  virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
859  {
860  _partialResult->initialize(&input, _par, (int)method);
861  return services::Status();
862  }
863 
864  void initialize()
865  {
866  Analysis<distributed>::_ac = new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step3Master, algorithmFPType, method)(&_env);
867  _in = &input;
868  _par = &parameter;
869  }
870 
871 public:
872  InputType input;
873  ParameterType parameter;
875 private:
876  DistributedStep3MasterPlusPlusPartialResultPtr _partialResult;
877 };
878 
899 template<typename algorithmFPType, Method method>
900 class DAAL_EXPORT Distributed<step4Local, algorithmFPType, method> : public daal::algorithms::Analysis<distributed>
901 {
902 public:
903  typedef algorithms::kmeans::init::DistributedStep4LocalPlusPlusInput InputType;
904  typedef algorithms::kmeans::init::Parameter ParameterType;
905  typedef algorithms::kmeans::init::DistributedStep4LocalPlusPlusPartialResult PartialResultType;
906 
911  Distributed(size_t nClusters) : parameter(nClusters)
912  {
913  initialize();
914  }
915 
921  Distributed(const Distributed<step4Local, algorithmFPType, method> &other) : parameter(other.parameter), input(other.input)
922  {
923  initialize();
924  }
925 
930  virtual int getMethod() const DAAL_C11_OVERRIDE{ return(int)method; }
931 
936  DistributedStep4LocalPlusPlusPartialResultPtr getPartialResult()
937  {
938  return _partialResult;
939  }
940 
945  services::Status setPartialResult(const DistributedStep4LocalPlusPlusPartialResultPtr& partialRes)
946  {
947  DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
948  _partialResult = partialRes;
949  _pres = _partialResult.get();
950  return services::Status();
951  }
952 
956  services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
957  {
958  return services::Status();
959  }
960 
966  services::SharedPtr<Distributed<step4Local, algorithmFPType, method> > clone() const
967  {
968  return services::SharedPtr<Distributed<step4Local, algorithmFPType, method> >(cloneImpl());
969  }
970 
971 protected:
972  virtual Distributed<step4Local, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
973  {
974  return new Distributed<step4Local, algorithmFPType, method>(*this);
975  }
976 
977  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
978  {
979  return services::Status();
980  }
981 
982  virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
983  {
984  _partialResult.reset(new PartialResultType());
985  services::Status s = _partialResult->allocate<algorithmFPType>(&input, _par, (int)method);
986  _pres = _partialResult.get();
987  return s;
988  }
989 
990  virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
991  {
992  return services::Status();
993  }
994 
995  void initialize()
996  {
997  Analysis<distributed>::_ac = new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step4Local, algorithmFPType, method)(&_env);
998  _in = &input;
999  _par = &parameter;
1000  }
1001 
1002 public:
1003  InputType input;
1004  ParameterType parameter;
1006 private:
1007  DistributedStep4LocalPlusPlusPartialResultPtr _partialResult;
1008 };
1009 
1030 template<typename algorithmFPType, Method method>
1031 class DAAL_EXPORT Distributed<step5Master, algorithmFPType, method> : public daal::algorithms::Analysis<distributed>
1032 {
1033 public:
1034  typedef algorithms::kmeans::init::DistributedStep5MasterPlusPlusInput InputType;
1035  typedef algorithms::kmeans::init::Parameter ParameterType;
1036  typedef algorithms::kmeans::init::Result ResultType;
1037  typedef algorithms::kmeans::init::DistributedStep5MasterPlusPlusPartialResult PartialResultType;
1038 
1043  Distributed(size_t nClusters) : parameter(nClusters)
1044  {
1045  initialize();
1046  }
1047 
1053  Distributed(const Distributed<step5Master, algorithmFPType, method> &other) : parameter(other.parameter), input(other.input)
1054  {
1055  initialize();
1056  }
1057 
1062  virtual int getMethod() const DAAL_C11_OVERRIDE{ return(int)method; }
1063 
1068  ResultPtr getResult()
1069  {
1070  return _result;
1071  }
1072 
1077  services::Status setResult(const ResultPtr& result)
1078  {
1079  DAAL_CHECK(result, services::ErrorNullResult)
1080  _result = result;
1081  _res = _result.get();
1082  return services::Status();
1083  }
1084 
1089  DistributedStep5MasterPlusPlusPartialResultPtr getPartialResult()
1090  {
1091  return _partialResult;
1092  }
1093 
1098  services::Status setPartialResult(const DistributedStep5MasterPlusPlusPartialResultPtr& partialRes)
1099  {
1100  DAAL_CHECK(partialRes, services::ErrorNullPartialResult);
1101  _partialResult = partialRes;
1102  _pres = _partialResult.get();
1103  return services::Status();
1104  }
1105 
1109  services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
1110  {
1111  return services::Status();
1112  }
1113 
1119  services::SharedPtr<Distributed<step5Master, algorithmFPType, method> > clone() const
1120  {
1121  return services::SharedPtr<Distributed<step5Master, algorithmFPType, method> >(cloneImpl());
1122  }
1123 
1124 protected:
1125  virtual Distributed<step5Master, algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
1126  {
1127  return new Distributed<step5Master, algorithmFPType, method>(*this);
1128  }
1129 
1130  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
1131  {
1132  _result.reset(new ResultType());
1133  services::Status s = _result->allocate<algorithmFPType>(_pres, _par, (int)method);
1134  _res = _result.get();
1135  return s;
1136  }
1137 
1138  virtual services::Status allocatePartialResult() DAAL_C11_OVERRIDE
1139  {
1140  _partialResult.reset(new PartialResultType());
1141  services::Status s = _partialResult->allocate<algorithmFPType>(&input, _par, (int)method);
1142  _pres = _partialResult.get();
1143  return s;
1144  }
1145 
1146  virtual services::Status initializePartialResult() DAAL_C11_OVERRIDE
1147  {
1148  return services::Status();
1149  }
1150 
1151  void initialize()
1152  {
1153  Analysis<distributed>::_ac = new __DAAL_ALGORITHM_CONTAINER(distributed, DistributedContainer, step5Master, algorithmFPType, method)(&_env);
1154  _in = &input;
1155  _par = &parameter;
1156  }
1157 
1158 public:
1159  InputType input;
1160  ParameterType parameter;
1162 private:
1163  DistributedStep5MasterPlusPlusPartialResultPtr _partialResult;
1164  ResultPtr _result;
1165 };
1166 } // namespace interface1
1167 using interface1::DistributedContainer;
1168 using interface1::Distributed;
1169 } // namespace daal::algorithms::kmeans::init
1170 } // namespace daal::algorithms::kmeans
1171 } // namespace daal::algorithms
1172 } // namespace daal
1173 #endif
daal::algorithms::kmeans::interface1::Distributed
Computes the results of the K-Means algorithm in the distributed processing mode. ...
Definition: kmeans_distributed.h:159
daal::step2Local
Definition: daal_defines.h:148
daal::algorithms::kmeans::init::interface1::Distributed< step3Master, algorithmFPType, method >::Distributed
Distributed(const Distributed< step3Master, algorithmFPType, method > &other)
Definition: kmeans_init_distributed.h:789
daal::algorithms::kmeans::init::interface1::Distributed< step2Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step2Local, algorithmFPType, method > &other)
Definition: kmeans_init_distributed.h:657
daal::algorithms::kmeans::init::interface1::Distributed< step3Master, algorithmFPType, method >::Distributed
Distributed(size_t nClusters)
Definition: kmeans_init_distributed.h:779
daal::algorithms::kmeans::init::interface1::DistributedStep5MasterPlusPlusInput
Interface for the K-Means distributed Input classes.
Definition: kmeans_init_types.h:764
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::step5Master
Definition: daal_defines.h:150
daal::algorithms::kmeans::init::interface1::Distributed< step4Local, algorithmFPType, method >
Computes initial clusters for the K-Means algorithm in the 4th step of the distributed processing mod...
Definition: kmeans_init_distributed.h:900
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:79
daal::algorithms::kmeans::init::interface1::Distributed< step4Local, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const DistributedStep4LocalPlusPlusPartialResultPtr &partialRes)
Definition: kmeans_init_distributed.h:945
daal::algorithms::kmeans::init::interface1::DistributedStep4LocalPlusPlusInput
Interface for the K-Means distributed Input classes used with plusPlus and parallelPlus methods only ...
Definition: kmeans_init_types.h:704
daal::algorithms::kmeans::init::interface1::Distributed< step5Master, algorithmFPType, method >::Distributed
Distributed(const Distributed< step5Master, algorithmFPType, method > &other)
Definition: kmeans_init_distributed.h:1053
daal::algorithms::kmeans::init::interface1::PartialResult
Partial results obtained with the compute() method of the K-Means algorithm in the batch processing m...
Definition: kmeans_init_types.h:383
daal::algorithms::kmeans::init::interface1::DistributedStep2MasterInput
Input objects for computing initials clusters for the K-Means algorithm in the second step of the dis...
Definition: kmeans_init_types.h:521
daal::algorithms::kmeans::init::interface1::Distributed< step4Local, algorithmFPType, method >::getPartialResult
DistributedStep4LocalPlusPlusPartialResultPtr getPartialResult()
Definition: kmeans_init_distributed.h:936
daal::algorithms::kmeans::init::interface1::Distributed< step3Master, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const DistributedStep3MasterPlusPlusPartialResultPtr &partialRes)
Definition: kmeans_init_distributed.h:813
daal::algorithms::kmeans::init::interface1::Distributed< step1Local, algorithmFPType, method >::checkFinalizeComputeParams
services::Status checkFinalizeComputeParams() DAAL_C11_OVERRIDE
Definition: kmeans_init_distributed.h:383
daal::algorithms::kmeans::init::interface1::Distributed< step2Master, algorithmFPType, method >
Computes initial clusters for the K-Means algorithm in the 2nd step of the distributed processing mod...
Definition: kmeans_init_distributed.h:459
daal::algorithms::kmeans::init::interface1::Distributed< step2Master, algorithmFPType, method >::Distributed
Distributed(size_t nClusters, size_t offset=0)
Definition: kmeans_init_distributed.h:472
daal::services::ErrorNullPartialResult
Definition: error_indexes.h:131
daal::algorithms::kmeans::init::interface1::DistributedStep2LocalPlusPlusPartialResult
Partial results obtained with the compute() method of the K-Means algorithm in the distributed proces...
Definition: kmeans_init_types.h:825
daal::algorithms::kmeans::init::interface1::Distributed< step1Local, algorithmFPType, method >::parameter
ParameterType parameter
Definition: kmeans_init_distributed.h:434
daal::algorithms::kmeans::init::interface1::DistributedStep2LocalPlusPlusParameter
Parameters for computing initial centroids for the K-Means algorithm.
Definition: kmeans_init_types.h:574
daal_defines.h
daal::step3Master
Definition: daal_defines.h:149
daal::algorithms::kmeans::init::interface1::Distributed< step3Master, algorithmFPType, method >::getPartialResult
DistributedStep3MasterPlusPlusPartialResultPtr getPartialResult()
Definition: kmeans_init_distributed.h:804
daal::algorithms::kmeans::init::interface1::Distributed< step4Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step4Local, algorithmFPType, method > > clone() const
Definition: kmeans_init_distributed.h:966
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:133
daal::algorithms::kmeans::init::interface1::Distributed< step4Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step4Local, algorithmFPType, method > &other)
Definition: kmeans_init_distributed.h:921
daal::algorithms::kmeans::init::interface1::Distributed< step2Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step2Local, algorithmFPType, method > > clone() const
Definition: kmeans_init_distributed.h:702
daal::algorithms::kmeans::init::interface1::Distributed< step2Local, algorithmFPType, method >
Computes initial clusters for the K-Means algorithm in the 2nd step of the distributed processing mod...
Definition: kmeans_init_distributed.h:635
daal::algorithms::kmeans::init::interface1::Distributed< step2Master, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step2Master, algorithmFPType, method > > clone() const
Definition: kmeans_init_distributed.h:558
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::kmeans::init::interface1::Distributed< step1Local, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const PartialResultPtr &partialRes)
Definition: kmeans_init_distributed.h:372
daal::algorithms::kmeans::init::interface1::Input::get
data_management::NumericTablePtr get(InputId id) const
daal::algorithms::kmeans::init::interface1::Distributed< step1Local, algorithmFPType, method >::input
InputType input
Definition: kmeans_init_distributed.h:433
daal::algorithms::kmeans::init::interface1::Distributed< step3Master, algorithmFPType, method >
Computes initial clusters for the K-Means algorithm in the 3rd step of the distributed processing mod...
Definition: kmeans_init_distributed.h:768
daal::algorithms::kmeans::init::interface1::DistributedStep5MasterPlusPlusPartialResult
Partial results obtained with the compute() method of the K-Means algorithm in the distributed proces...
Definition: kmeans_init_types.h:1054
daal::algorithms::kmeans::init::interface1::DistributedStep3MasterPlusPlusPartialResult
Partial results obtained with the compute() method of the K-Means algorithm in the distributed proces...
Definition: kmeans_init_types.h:908
daal::algorithms::kmeans::init::interface1::Result
Results obtained with the compute() method that computes initial centroids for the K-Means algorithm ...
Definition: kmeans_init_types.h:450
daal::algorithms::kmeans::init::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(const Distributed< step1Local, algorithmFPType, method > &other)
Definition: kmeans_init_distributed.h:326
daal::algorithms::kmeans::init::interface1::Distributed< step5Master, algorithmFPType, method >
Computes initial clusters for the K-Means algorithm in the 5th step of the distributed processing mod...
Definition: kmeans_init_distributed.h:1031
daal::algorithms::kmeans::init::interface1::Distributed< step1Local, algorithmFPType, method >
Computes initial clusters for the K-Means algorithm in the first step of the distributed processing m...
Definition: kmeans_init_distributed.h:301
daal::algorithms::kmeans::init::interface1::DistributedStep2LocalPlusPlusInput
Interface for the K-Means initialization distributed Input classes used with plusPlus and parallelPlu...
Definition: kmeans_init_types.h:600
daal::algorithms::kmeans::init::interface1::Distributed< step1Local, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step1Local, algorithmFPType, method > > clone() const
Definition: kmeans_init_distributed.h:393
daal::algorithms::kmeans::init::interface1::Parameter
Parameters for computing initial centroids for the K-Means algorithm.
Definition: kmeans_init_types.h:293
daal::algorithms::kmeans::init::interface1::Distributed< step1Local, algorithmFPType, method >::Distributed
Distributed(size_t nClusters, size_t nRowsTotal, size_t offset=0)
Definition: kmeans_init_distributed.h:315
daal::step4Local
Definition: daal_defines.h:146
daal::algorithms::kmeans::init::interface1::DistributedContainer
class DAAL_EXPORT DistributedContainer
Provides methods to run implementations of initialization of the K-Means algorithm. This class is associated with the daal::algorithms::kmeans::init::Distributed class and supports the method of computing initial clusters for the K-Means algorithm in the distributed processing mode.
Definition: kmeans_init_distributed.h:83
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:94
daal::algorithms::kmeans::init::interface1::Distributed< step5Master, algorithmFPType, method >::getPartialResult
DistributedStep5MasterPlusPlusPartialResultPtr getPartialResult()
Definition: kmeans_init_distributed.h:1089
daal::algorithms::kmeans::init::interface1::Distributed< step1Local, algorithmFPType, method >::getResult
ResultPtr getResult()
Definition: kmeans_init_distributed.h:342
daal::step1Local
Definition: daal_defines.h:143
daal::step2Master
Definition: daal_defines.h:144
daal::algorithms::kmeans::init::interface1::Distributed< step2Local, algorithmFPType, method >::getPartialResult
DistributedStep2LocalPlusPlusPartialResultPtr getPartialResult()
Definition: kmeans_init_distributed.h:672
daal::algorithms::kmeans::init::interface1::Distributed< step1Local, algorithmFPType, method >::getPartialResult
PartialResultPtr getPartialResult()
Definition: kmeans_init_distributed.h:363
daal::algorithms::kmeans::init::interface1::Distributed< step1Local, algorithmFPType, method >::setResult
services::Status setResult(const ResultPtr &result)
Definition: kmeans_init_distributed.h:351
daal::algorithms::kmeans::init::interface1::Distributed< step5Master, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const DistributedStep5MasterPlusPlusPartialResultPtr &partialRes)
Definition: kmeans_init_distributed.h:1098
daal::algorithms::kmeans::init::interface1::Distributed< step1Local, algorithmFPType, method >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: kmeans_init_distributed.h:336
daal::algorithms::kmeans::init::interface1::Distributed< step3Master, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step3Master, algorithmFPType, method > > clone() const
Definition: kmeans_init_distributed.h:834
daal::algorithms::kmeans::init::interface1::DistributedStep3MasterPlusPlusInput
Interface for the K-Means distributed Input classes used with plusPlus and parallelPlus methods only ...
Definition: kmeans_init_types.h:663
daal::algorithms::kmeans::init::interface1::Distributed< step5Master, algorithmFPType, method >::clone
services::SharedPtr< Distributed< step5Master, algorithmFPType, method > > clone() const
Definition: kmeans_init_distributed.h:1119
daal::algorithms::kmeans::init::interface1::Distributed< step2Local, algorithmFPType, method >::setPartialResult
services::Status setPartialResult(const DistributedStep2LocalPlusPlusPartialResultPtr &partialRes)
Definition: kmeans_init_distributed.h:681
daal::services::ErrorNullResult
Definition: error_indexes.h:122
daal::algorithms::kmeans::init::data
Definition: kmeans_init_types.h:109
daal::algorithms::kmeans::init::interface1::Distributed< step2Local, algorithmFPType, method >::Distributed
Distributed(size_t nClusters, bool bFirstIteration)
Definition: kmeans_init_distributed.h:647
daal::algorithms::kmeans::init::interface1::Input
Input objects for computing initial centroids for the K-Means algorithm
Definition: kmeans_init_types.h:342
daal::algorithms::kmeans::init::interface1::DistributedStep4LocalPlusPlusPartialResult
Partial results obtained with the compute() method of the K-Means algorithm in the distributed proces...
Definition: kmeans_init_types.h:993

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