/* Example programs from the book Scientific and Engineering Programming in C++: An Introduction with Advanced Techniques and Examples, Addison-Wesley, 1994. (c) COPYRIGHT INTERNATIONAL BUSINESS MACHINES CORPORATION 1994. ALL RIGHTS RESERVED. See README file for further details. */ template FunctionalAlgebra& FunctionalAlgebra:: operator+=(const FunctionalAlgebra& rhs) { f = new AddFunctional( f, rhs.f ); return *this; } template CloneableObjPtr< IsoFunctional > FunctionalAlgebra::operator()(const FunctionalAlgebra& inner) const{ CloneableObjPtr< IsoFunctional > it(inner.clone()); CloneableObjPtr< IsoFunctional > ot(f); return new CompositionFunctional( it , ot ); } template FunctionalAlgebra& FunctionalAlgebra::operator-=(const FunctionalAlgebra& rhs) { f = new SubtractFunctional( f, rhs.f ); return *this; } template FunctionalAlgebra& FunctionalAlgebra::operator*=(const FunctionalAlgebra& rhs) { f = new MultiplyFunctional( f, rhs.f ); return *this; } template FunctionalAlgebra& FunctionalAlgebra::operator/=(const FunctionalAlgebra& rhs) { f = new DivideFunctional( f, rhs.f ); return *this; } template FunctionalAlgebra& FunctionalAlgebra::setToZero() { f = new ZeroFunctional(); return *this; } template FunctionalAlgebra& FunctionalAlgebra::setToOne() { f = new OneFunctional(); return *this; } template FunctionalAlgebra& FunctionalAlgebra::negate() { f = new AdditiveInverseFunctional(f); return *this; } template FunctionalAlgebra& FunctionalAlgebra::invert() { f = new MultiplicativeInverseFunctional(f); return *this; } template FunctionalAlgebra& FunctionalAlgebra::operator*=(const Domain& rhs) { f = new MultiplyFunctional(f, rhs); return *this; } template FunctionalAlgebra& FunctionalAlgebra::operator/=(const Domain& rhs) { f = new DivideFunctional(f, rhs); return *this; } template FunctionalAlgebra::FunctionalAlgebra(const Domain& d) : f( new ConstantFunctional(d) ) { } template FunctionalAlgebra::FunctionalAlgebra(const CountedBuiltInPtr& d) : f( new ParameterFunctional(d) ) { } template FunctionalAlgebra::FunctionalAlgebra() : f( new XFunctional() ) { } #include "Function/CompositionFunctional.h" #include "Function/ExpFunctional.h" template FunctionalAlgebra exp(const FunctionalAlgebra& f) { return new CompositionFunctional( f.f, new ExpFunctional() ); } #include "Function/LogFunctional.h" template FunctionalAlgebra log(const FunctionalAlgebra& f){ return new CompositionFunctional( f.f, new LogFunctional() ); } #include "Function/SqrtFunctional.h" template FunctionalAlgebra sqrt(const FunctionalAlgebra& f){ return new CompositionFunctional( f.f, new SqrtFunctional() ); } #include "Function/Log10Functional.h" template FunctionalAlgebra log10(const FunctionalAlgebra& f){ return new CompositionFunctional( f.f, new Log10Functional() ); } #include "Function/SinFunctional.h" template FunctionalAlgebra sin(const FunctionalAlgebra& f){ return new CompositionFunctional( f.f, new SinFunctional() ); } #include "Function/CosFunctional.h" template FunctionalAlgebra cos(const FunctionalAlgebra& f){ return new CompositionFunctional( f.f, new CosFunctional() ); } #include "Function/ASinFunctional.h" template FunctionalAlgebra asin(const FunctionalAlgebra& f){ return new CompositionFunctional( f.f, new ASinFunctional() ); } #include "Function/ACosFunctional.h" template FunctionalAlgebra acos(const FunctionalAlgebra& f){ return new CompositionFunctional( f.f, new ACosFunctional() ); } template FunctionalAlgebra::FunctionalAlgebra(const IsoFunctional& fp) : f(fp.clone()) { } template FunctionalAlgebra::FunctionalAlgebra(IsoFunctional* just_newed) : f(just_newed) { }