diff --git a/MathLib/ConstantFunction.h b/MathLib/ConstantFunction.h deleted file mode 100644 index 4f04ac54615ada8c93ba78b8cd5cf8e25426b1e7..0000000000000000000000000000000000000000 --- a/MathLib/ConstantFunction.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * \author Norihiro Watanabe - * \date 2013-08-13 - * - * \copyright - * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org) - * Distributed under a Modified BSD License. - * See accompanying file LICENSE.txt or - * http://www.opengeosys.org/project/license - * - */ - -#pragma once - -#include <array> -#include <numeric> - -namespace MathLib -{ - -/** - * A constant function. - * \f[ - * f(x_1,...,x_k)=a_0 - * \f] - */ -template <typename T_TYPE> -class ConstantFunction -{ -public: - explicit ConstantFunction(T_TYPE const& value) - : _value(value) - {} - - T_TYPE operator()() const - { - return _value; - } -private: - T_TYPE const _value; -}; - -} diff --git a/MathLib/LinearFunction.h b/MathLib/LinearFunction.h deleted file mode 100644 index 47285852720eab7ae8a0abd0f6a5eadf7fba70ae..0000000000000000000000000000000000000000 --- a/MathLib/LinearFunction.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * \author Norihiro Watanabe - * \date 2013-08-13 - * - * \copyright - * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org) - * Distributed under a Modified BSD License. - * See accompanying file LICENSE.txt or - * http://www.opengeosys.org/project/license - * - */ - -#pragma once - -#include <array> -#include <numeric> -#include <utility> - -namespace MathLib -{ - -/** - * Linear function - * \f[ - * f(x_1,...,x_k)=a_0+a_1*x_1+...+a_k*x_k - * \f] - * - * \tparam T_TYPE value type - * \tparam N_VARS the number of variables (k) - */ -template <typename T_TYPE, unsigned N_VARS> -class LinearFunction -{ -public: - /** - * Constructor - * \param coefficients an array of coefficients of a linear function. - * The size of the coefficient array should equal to the number of variables + 1 - */ - explicit LinearFunction(std::array<T_TYPE, N_VARS + 1> coefficients) - : _coefficients(std::move(coefficients)) - {} - - /** - * evaluate the function - * \param x an array of variables. the size of the array should equal to the number of variables - */ - T_TYPE operator()(T_TYPE const * const x) const - { - return std::inner_product(_coefficients.cbegin()+1, _coefficients.cend(), x, _coefficients.front()); - } - -private: - /// Coefficients of a linear function - const std::array<T_TYPE, N_VARS+1> _coefficients; -}; - -} // namespace MathLib