// Emacs will be in -*- Mode: c++ -*- // @HEADER // ***************************************************************************** // Sacado Package // // Copyright 2006 NTESS and the Sacado contributors. // SPDX-License-Identifier: LGPL-2.1-or-later // ***************************************************************************** // @HEADER // ********** DO NOT REMOVE THIS BANNER ********** // // SUMMARY: Tools for Automatic Differentiaton (order 1) // RELEASE: 0.1 // USAGE : You may copy freely these files and use it for // teaching or research. These or part of these may // not be sold or used for a commercial purpose with- // out our consent : fax (33)1 44 27 72 00 // // AUTHOR : Nicolas Di cesare // ORG : // E-MAIL : Nicolas.Dicesare@ann.jussieu.fr // // ORIG-DATE: September 97 // LAST-MOD : 28/07/98 // ******************************************************** // FILE : tinyfadbin.h // ******************************************************** #ifndef _tinyfadbin_h_ #define _tinyfadbin_h_ template inline TinyFad::promote > operator +(const TinyFad& un, const TinyFad& deux) { typedef typename NumericalTraits::promote value_type; No_Initialization nothing; TinyFad tmp( nothing ); for (int i=0; i inline TinyFad::promote> operator +(const TinyFad& un, const R& deux) { typedef typename NumericalTraits::promote value_type; No_Initialization nothing; TinyFad tmp( nothing ); for (int i=0; i inline TinyFad::promote > operator +(const L& un, const TinyFad& deux) { return operator +(deux,un); } template inline TinyFad::promote > operator *(const TinyFad& un, const TinyFad& deux) { typedef typename NumericalTraits::promote value_type; No_Initialization nothing; TinyFad tmp( nothing ); for (int i=0; i inline TinyFad::promote > operator *(const TinyFad& un, const R& deux) { typedef typename NumericalTraits::promote value_type; No_Initialization nothing; TinyFad tmp( nothing ); for (int i=0; i inline TinyFad::promote > operator *(const L& un, const TinyFad& deux) { return operator *(deux,un); } //------------------------------------------------------- template inline TinyFad::promote > operator -(const TinyFad & un, const TinyFad & deux) { typedef typename NumericalTraits::promote value_type; No_Initialization nothing; TinyFad tmp( nothing ); for (int i=0; i inline TinyFad::promote> operator -(const L & un, const TinyFad & deux) { typedef typename NumericalTraits::promote value_type; No_Initialization nothing; TinyFad tmp( nothing ); for (int i=0; i inline TinyFad::promote > operator -(const TinyFad & un, const R & deux) { typedef typename NumericalTraits::promote value_type; No_Initialization nothing; TinyFad tmp( nothing ); for (int i=0; i inline TinyFad::promote > operator /(const TinyFad & un, const TinyFad & deux) { typedef typename NumericalTraits::promote value_type; if (deux.val() == 0.) error("TinyFad & TinyFad::operator /(const TinyFad & un, const TinyFad & deux), dividing by 0"); No_Initialization nothing; TinyFad tmp( nothing ); value_type dval = deux.val(); for (int i=0; i inline TinyFad::promote > operator /(const L & un, const TinyFad & deux) { typedef typename NumericalTraits::promote value_type; if (deux.val() == 0.) error("TinyFad & TinyFad::operator /(const L & un, const TinyFad & deux), dividing by 0"); No_Initialization nothing; TinyFad tmp( nothing ); value_type dval = deux.val(); for (int i=0; i inline TinyFad::promote > operator /(const TinyFad & un, const R & deux) { typedef typename NumericalTraits::promote value_type; if (deux == 0.) error("TinyFad & TinyFad::operator /(const TinyFad & un, const R & deux), dividing by 0"); No_Initialization nothing; TinyFad tmp( nothing ); for (int i=0; i