<commit_before>// $Id: numericalIntegrator.h,v 1.6 2001/12/30 13:28:39 sturm Exp $

#ifndef BALL_MATHS_NUMERICALINTEGRATOR_H
#define BALL_MATHS_NUMERICALINTEGRATOR_H

#ifndef BALL_MATHS_FUNCTION_H
# include <BALL/MATHS/function.h>
#endif

namespace BALL
{

	/** Numerical integrator class.
			\\
			{\bf Definition:} \URL{BALL/MATHS/numericalIntegrator.h}
	*/
	template <typename Function, typename DataType = float>
	class NumericalIntegrator
	{

		public:

		BALL_CREATE(NumericalIntegrator)

		/// @name Constructors and destructor.
		//@{
		
		/// Default constructor
		NumericalIntegrator()
			throw();
		
		/// Copy constructor 
		NumericalIntegrator(const NumericalIntegrator& nint)
			throw();
		
		/// Destructor
		virtual ~NumericalIntegrator()
			throw();

		//@}


		/// @name Assignment
		//@{

		/// Assignment operator
		const NumericalIntegrator& operator = (const NumericalIntegrator& nint)
			throw();

		/// Clear method, might be unusable...
		virtual void clear()
			throw();

		//@}
		
		
		/// @name Predicates
		//@{

		/// Equality operator 
		bool operator == (const NumericalIntegrator& nint) const
			throw();

		//@}


		/// @name Accessors
		//@{

		/** set the function to be integrated
				@param the function to be assigned
		*/
		void setFunction(const Function& function)
			throw();

		/** get the function to be integrated
				@return a mutable reference to the actual function
		*/
		Function& getFunction()
			throw();

		/** Get the function to be integrated (const version).
				@return a const reference to the actual function
		*/
		const Function& getFunction() const
			throw();

		/** Get the value of the function at position {\em x}
				@param x the position at which {\tt function\_} is to be evaluated
				@return the value of {\tt function\_} at {\em x}
		*/
		DataType getValue(const DataType& x) const
			throw();

		/** Integrate the function numerically
				@param from lower limit of the integration
				@param to upper limit of the integration
				@return the value of the integral
		*/
		DataType integrate(const DataType& from, const DataType& to) const
			throw();

		//@}


		protected:

		//_ The function to be integrated
		Function function_;

	};


	template<typename Function, typename DataType>
	BALL_INLINE
	NumericalIntegrator<Function, DataType>::NumericalIntegrator()
		throw()
		: function_()
	{
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	NumericalIntegrator<Function, DataType>::NumericalIntegrator(const NumericalIntegrator<Function, DataType>& nint)
		throw()
		: function_(nint.function_)
	{
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	NumericalIntegrator<Function, DataType>::~NumericalIntegrator()
		throw()
	{
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	const NumericalIntegrator<Function, DataType>&
	NumericalIntegrator<Function, DataType>::operator =
	(const NumericalIntegrator<Function, DataType>& nint)
		throw()
	{
		function_ = nint.function_;
		return *this;
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	void NumericalIntegrator<Function, DataType>::clear()
		throw()
	{
		// ?????: 
		// Depending on the template there doesn't exist a clear() method, so I
		// commented it out. Any reasonable strategy?
		// function_.clear();
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	void NumericalIntegrator<Function, DataType>::setFunction
	(const Function& function)
		throw()
	{	
		function_ = function;
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	Function& NumericalIntegrator<Function, DataType>::getFunction()
		throw()
	{
		return function_;
	}<commit_msg>removed: clear method (meainigless in that class)<commit_after>// $Id: numericalIntegrator.h,v 1.7 2002/01/09 01:02:47 oliver Exp $

#ifndef BALL_MATHS_NUMERICALINTEGRATOR_H
#define BALL_MATHS_NUMERICALINTEGRATOR_H

#ifndef BALL_MATHS_FUNCTION_H
# include <BALL/MATHS/function.h>
#endif

namespace BALL
{

	/** Numerical integrator class.
			\\
			{\bf Definition:} \URL{BALL/MATHS/numericalIntegrator.h}
	*/
	template <typename Function, typename DataType = float>
	class NumericalIntegrator
	{

		public:

		BALL_CREATE(NumericalIntegrator)

		/// @name Constructors and destructor.
		//@{
		
		/// Default constructor
		NumericalIntegrator()
			throw();
		
		/// Copy constructor 
		NumericalIntegrator(const NumericalIntegrator& nint)
			throw();
		
		/// Destructor
		virtual ~NumericalIntegrator()
			throw();

		//@}


		/// @name Assignment
		//@{

		/// Assignment operator
		const NumericalIntegrator& operator = (const NumericalIntegrator& nint)
			throw();

		//@}
		
		
		/// @name Predicates
		//@{

		/// Equality operator 
		bool operator == (const NumericalIntegrator& nint) const
			throw();

		//@}


		/// @name Accessors
		//@{

		/** set the function to be integrated
				@param the function to be assigned
		*/
		void setFunction(const Function& function)
			throw();

		/** get the function to be integrated
				@return a mutable reference to the actual function
		*/
		Function& getFunction()
			throw();

		/** Get the function to be integrated (const version).
				@return a const reference to the actual function
		*/
		const Function& getFunction() const
			throw();

		/** Get the value of the function at position {\em x}
				@param x the position at which {\tt function\_} is to be evaluated
				@return the value of {\tt function\_} at {\em x}
		*/
		DataType getValue(const DataType& x) const
			throw();

		/** Integrate the function numerically
				@param from lower limit of the integration
				@param to upper limit of the integration
				@return the value of the integral
		*/
		DataType integrate(const DataType& from, const DataType& to) const
			throw();

		//@}


		protected:

		//_ The function to be integrated
		Function function_;

	};


	template<typename Function, typename DataType>
	BALL_INLINE
	NumericalIntegrator<Function, DataType>::NumericalIntegrator()
		throw()
		: function_()
	{
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	NumericalIntegrator<Function, DataType>::NumericalIntegrator(const NumericalIntegrator<Function, DataType>& nint)
		throw()
		: function_(nint.function_)
	{
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	NumericalIntegrator<Function, DataType>::~NumericalIntegrator()
		throw()
	{
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	const NumericalIntegrator<Function, DataType>&
	NumericalIntegrator<Function, DataType>::operator =
	(const NumericalIntegrator<Function, DataType>& nint)
		throw()
	{
		function_ = nint.function_;
		return *this;
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	void NumericalIntegrator<Function, DataType>::setFunction
	(const Function& function)
		throw()
	{	
		function_ = function;
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	Function& NumericalIntegrator<Function, DataType>::getFunction()
		throw()
	{
		return function_;
	}
{'fraction_non_alphanumeric': 0.1077273374128362, 'fraction_numerical': 0.004553863668706418, 'mean_word_length': 3.7486486486486488, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1355073', 'n_tokens_mistral': 2527, 'n_tokens_neox': 2113, 'n_words': 609}