Line data Source code
1 : #include "FixedStepSize.h" 2 : namespace elsa 3 : { 4 : 5 : template <typename data_t> 6 : FixedStepSize<data_t>::FixedStepSize(const Functional<data_t>& problem, data_t step_size) 7 : : LineSearchMethod<data_t>(problem), _step_size(step_size) 8 78 : { 9 : // sanity checks 10 78 : if (step_size <= 0) 11 0 : throw InvalidArgumentError("FixedStepSize: step_size has to be greater than 0"); 12 78 : } 13 : 14 : template <typename data_t> 15 : data_t FixedStepSize<data_t>::solve(DataContainer<data_t>, DataContainer<data_t>) 16 1426 : { 17 1426 : return _step_size; 18 1426 : } 19 : 20 : template <typename data_t> 21 : FixedStepSize<data_t>* FixedStepSize<data_t>::cloneImpl() const 22 48 : { 23 48 : return new FixedStepSize(*this->_problem, _step_size); 24 48 : } 25 : 26 : template <typename data_t> 27 : bool FixedStepSize<data_t>::isEqual(const LineSearchMethod<data_t>& other) const 28 24 : { 29 24 : auto otherFS = downcast_safe<FixedStepSize<data_t>>(&other); 30 24 : if (!otherFS) 31 0 : return false; 32 : 33 24 : return (_step_size == otherFS->_step_size); 34 24 : } 35 : 36 : // ------------------------------------------ 37 : // explicit template instantiation 38 : template class FixedStepSize<float>; 39 : template class FixedStepSize<double>; 40 : } // namespace elsa