// numeric standard header
#ifndef _NUMERIC_
#define _NUMERIC_

#pragma info(none)
#ifndef __CHKHDR__
#  pragma report(level, E)
#endif
#pragma info(restore)

#if __IBMCPP__ < 400
#error This file to be used only with IBM VisualAge C++ v4 and later compilers.
#endif /* __IBMCPP__ */

#pragma namemangling(ansi)

   /********************************************************************/
   /*  <numeric> header file                                           */
   /*                                                                  */
   /*  VisualAge C++, Version 4.0                                      */
   /*    Licensed Material - Property of IBM                           */
   /*                                                                  */
   /*  5801-AAR and Other Materials                                    */
   /*                                                                  */
   /*  (c) Copyright IBM Corp 1991, 1998. All rights reserved.         */
   /*                                                                  */
   /*                                                                  */
   /*  Licensed Materials.                                             */
   /*                                                                  */
   /*  Dinkum C++ Library                                              */
   /*  Copyright (c) 1998.  Licensed to IBM Corp. and its suppliers.   */
   /*                                                                  */
   /********************************************************************/

#include <iterator>
_STD_BEGIN
		// TEMPLATE FUNCTION accumulate
template<class _II, class _Ty> inline
	_Ty accumulate(_II _F, _II _L, _Ty _V)
	{for (; _F != _L; ++_F)
		_V = _V + *_F;
	return (_V); }
		// TEMPLATE FUNCTION accumulate WITH BINOP
template<class _II, class _Ty, class _Bop> inline
	_Ty accumulate(_II _F, _II _L, _Ty _V, _Bop _B)
	{for (; _F != _L; ++_F)
		_V = _B(_V, *_F);
	return (_V); }
		// TEMPLATE FUNCTION inner_product
template<class _II1, class _II2, class _Ty> inline
	_Ty inner_product(_II1 _F, _II1 _L, _II2 _X, _Ty _V)
	{for (; _F != _L; ++_F, ++_X)
		_V = _V + *_F * *_X;
	return (_V); }
		// TEMPLATE FUNCTION inner_product WITH BINOPS
template<class _II1, class _II2, class _Ty,
	class _Bop1, class _Bop2> inline
	_Ty inner_product(_II1 _F, _II1 _L, _II2 _X, _Ty _V,
		_Bop1 _B1, _Bop2 _B2)
	{for (; _F != _L; ++_F, ++_X)
		_V = _B1(_V, _B2(*_F, *_X));
	return (_V); }
		// TEMPLATE FUNCTION partial_sum
template<class _II, class _OI> inline
	_OI partial_sum(_II _F, _II _L, _OI _X)
	{return (_F == _L ? _X
		: _Partial_sum(_F, _L, _X, _Val_type(_F))); }
template<class _II, class _OI, class _Ty> inline
	_OI _Partial_sum(_II _F, _II _L, _OI _X, _Ty *)
	{_Ty _V = *_F;
	for (*_X = _V; ++_F != _L; *++_X = _V)
		_V = _V + *_F;
	return (++_X); }
		// TEMPLATE FUNCTION partial_sum WITH BINOP
template<class _II, class _OI, class _Bop> inline
	_OI partial_sum(_II _F, _II _L, _OI _X, _Bop _B)
	{return (_F == _L ? _X
		: _Partial_sum(_F, _L, _X, _B, _Val_type(_F))); }
template<class _II, class _OI, class _Bop, class _Ty> inline
	_OI _Partial_sum(_II _F, _II _L, _OI _X, _Bop _B, _Ty *)
	{_Ty _V = *_F;
	for (*_X = _V; ++_F != _L; *++_X = _V)
		_V = _B(_V, *_F);
	return (++_X); }
		// TEMPLATE FUNCTION adjacent_difference
template<class _II, class _OI> inline
	_OI adjacent_difference(_II _F, _II _L, _OI _X)
	{return (_F == _L ? _X
		: _Adjacent_difference(_F, _L, _X, _Val_type(_F))); }
template<class _II, class _OI, class _Ty> inline
	_OI _Adjacent_difference(_II _F, _II _L, _OI _X, _Ty *)
	{_Ty _V = *_F;
	for (*_X = _V; ++_F != _L; )
		{_Ty _Tmp = *_F;
		*++_X = _Tmp - _V;
		_V = _Tmp; }
	return (++_X); }
		// TEMPLATE FUNCTION adjacent_difference WITH BINOP
template<class _II, class _OI, class _Bop> inline
	_OI adjacent_difference(_II _F, _II _L, _OI _X, _Bop _B)
	{return (_F == _L ? _X
		: _Adjacent_difference(_F, _L, _X, _B, _Val_type(_F))); }
template<class _II, class _OI, class _Bop, class _Ty> inline
	_OI _Adjacent_difference(_II _F, _II _L, _OI _X,
		_Bop _B, _Ty *)
	{_Ty _V = *_F;
	for (*_X = _V; ++_F != _L; )
		{_Ty _Tmp = *_F;
		*++_X = _B(_Tmp, _V);
		_V = _Tmp; }
	return (++_X); }
_STD_END

#pragma namemangling()

#pragma info(none)
#ifndef __CHKHDR__
#  pragma report(pop)
#endif
#pragma info(restore)

#endif /* _NUMERIC_ */

/*
 * Copyright (c) 1995 by P.J. Plauger.  ALL RIGHTS RESERVED. 
 * Consult your license regarding permissions and restrictions.
 */

/*
 * This file is derived from software bearing the following
 * restrictions:
 *
 * Copyright (c) 1994
 * Hewlett-Packard Company
 *
 * Permission to use, copy, modify, distribute and sell this
 * software and its documentation for any purpose is hereby
 * granted without fee, provided that the above copyright notice
 * appear in all copies and that both that copyright notice and
 * this permission notice appear in supporting documentation.
 * Hewlett-Packard Company makes no representations about the
 * suitability of this software for any purpose. It is provided
 * "as is" without express or implied warranty.
V2.2:0081 */
