48 #ifndef __PRECOMPUTED_BATCH_H__
49 #define __PRECOMPUTED_BATCH_H__
51 #include "algorithms/algorithm.h"
52 #include "services/daal_defines.h"
53 #include "objective_function_batch.h"
54 #include "sum_of_functions_batch.h"
55 #include "precomputed_types.h"
61 namespace optimization_solver
82 template<
typename algorithmFPType, Method method>
83 class DAAL_EXPORT BatchContainer :
public daal::algorithms::AnalysisContainerIface<batch>
91 BatchContainer(daal::services::Environment::env *daalEnv) {}
92 virtual ~BatchContainer() {}
98 virtual services::Status compute()
101 return services::Status();
119 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
120 class DAAL_EXPORT Batch :
public sum_of_functions::Batch
123 sum_of_functions::Input input;
125 sum_of_functions::Parameter parameter;
130 Batch() : parameter(1), sum_of_functions::Batch(1, &input, ¶meter)
143 Batch(
const Batch<algorithmFPType, method> &other) :
144 parameter(other.parameter), sum_of_functions::Batch(other.parameter.numberOfTerms, &input, ¶meter), input(other.input)
147 const objective_function::Result *otherResult =
const_cast<Batch<algorithmFPType, method> &
>(other).getResult().get();
150 bool isResultInitialized =
false;
151 isResultInitialized = (isResultInitialized || otherResult->get(objective_function::gradientIdx));
152 _result->set(objective_function::gradientIdx, otherResult->get(objective_function::gradientIdx));
153 isResultInitialized = (isResultInitialized || otherResult->get(objective_function::valueIdx));
154 _result->set(objective_function::valueIdx, otherResult->get(objective_function::valueIdx));
155 isResultInitialized = (isResultInitialized || otherResult->get(objective_function::hessianIdx));
156 _result->set(objective_function::hessianIdx, otherResult->get(objective_function::hessianIdx));
157 if (isResultInitialized)
159 _res = _result.get();
168 virtual int getMethod() const DAAL_C11_OVERRIDE {
return (
int)method; }
175 services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
177 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
185 services::Status allocate()
187 return allocateResult();
191 virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
193 return new Batch<algorithmFPType, method>(*this);
196 virtual services::Status allocateResult() DAAL_C11_OVERRIDE
198 services::Status s = _result->allocate<algorithmFPType>(&input, ¶meter, (int) method);
199 _res = _result.get();
205 Analysis<batch>::_ac =
new BatchContainer<algorithmFPType, method>(&_env);
208 _result = objective_function::ResultPtr(
new objective_function::Result());
213 using interface1::BatchContainer;
214 using interface1::Batch;
daal::algorithms::optimization_solver::precomputed::interface1::Batch::Batch
Batch()
Definition: precomputed_batch.h:130
daal
Definition: algorithm_base_common.h:57
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:79
daal::algorithms::optimization_solver::precomputed::interface1::BatchContainer
Provides methods to run implementations of the objective function with precomputed characteristics...
Definition: precomputed_batch.h:83
daal::algorithms::optimization_solver::precomputed::interface1::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)
Definition: precomputed_batch.h:91
daal::algorithms::optimization_solver::precomputed::interface1::Batch::input
sum_of_functions::Input input
Definition: precomputed_batch.h:123
daal::algorithms::optimization_solver::objective_function::gradientIdx
Definition: objective_function_types.h:104
daal::algorithms::optimization_solver::objective_function::hessianIdx
Definition: objective_function_types.h:106
daal::algorithms::optimization_solver::objective_function::valueIdx
Definition: objective_function_types.h:105
daal::algorithms::optimization_solver::precomputed::interface1::Batch
Computes the objective function with precomputed characteristics in the batch processing mode...
Definition: precomputed_batch.h:120
daal::algorithms::optimization_solver::precomputed::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: precomputed_batch.h:175
daal::algorithms::optimization_solver::precomputed::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: precomputed_batch.h:143
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:94
daal::algorithms::optimization_solver::precomputed::interface1::BatchContainer::compute
virtual services::Status compute()
Definition: precomputed_batch.h:98
daal::algorithms::optimization_solver::precomputed::interface1::Batch::allocate
services::Status allocate()
Definition: precomputed_batch.h:185
daal::algorithms::optimization_solver::precomputed::interface1::Batch::parameter
sum_of_functions::Parameter parameter
Definition: precomputed_batch.h:125
daal::algorithms::optimization_solver::precomputed::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: precomputed_batch.h:168