Sacado_PCE_OrthogPolyImp.hpp

Go to the documentation of this file.
00001 // $Id$ 
00002 // $Source$ 
00003 // @HEADER
00004 // ***********************************************************************
00005 // 
00006 //                           Sacado Package
00007 //                 Copyright (2006) Sandia Corporation
00008 // 
00009 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00010 // license for use of this work by or on behalf of the U.S. Government.
00011 // 
00012 // This library is free software; you can redistribute it and/or modify
00013 // it under the terms of the GNU Lesser General Public License as
00014 // published by the Free Software Foundation; either version 2.1 of the
00015 // License, or (at your option) any later version.
00016 //  
00017 // This library is distributed in the hope that it will be useful, but
00018 // WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 // Lesser General Public License for more details.
00021 //  
00022 // You should have received a copy of the GNU Lesser General Public
00023 // License along with this library; if not, write to the Free Software
00024 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 // USA
00026 // Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
00027 // (etphipp@sandia.gov).
00028 // 
00029 // ***********************************************************************
00030 // @HEADER
00031 
00032 #include "Sacado_DynamicArrayTraits.hpp"
00033 #include "Stokhos_ConstantOrthogPolyExpansion.hpp"
00034 
00035 namespace Sacado {
00036 namespace PCE {
00037 
00038 template <typename T> 
00039 OrthogPoly<T>::
00040 OrthogPoly() :
00041   expansion_(),
00042   th(new Stokhos::OrthogPolyApprox<int,value_type>)
00043 {
00044   expansion_ = Teuchos::rcp(new Stokhos::ConstantOrthogPolyExpansion<int,T>);
00045 }
00046 
00047 template <typename T> 
00048 OrthogPoly<T>::
00049 OrthogPoly(const typename OrthogPoly<T>::value_type& x) :
00050   expansion_(),
00051   th(new Stokhos::OrthogPolyApprox<int,value_type>)
00052 {
00053   expansion_ = Teuchos::rcp(new Stokhos::ConstantOrthogPolyExpansion<int,T>);
00054   (*th)[0] = x;
00055 }
00056 
00057 template <typename T> 
00058 OrthogPoly<T>::
00059 OrthogPoly(const Teuchos::RCP<expansion_type>& expansion) :
00060   expansion_(expansion),
00061   th(new Stokhos::OrthogPolyApprox<int,value_type>(expansion_->getBasis()))
00062 {
00063 }
00064 
00065 template <typename T> 
00066 OrthogPoly<T>::
00067 OrthogPoly(const OrthogPoly<T>& x) :
00068   expansion_(x.expansion_),
00069   th(x.th)
00070 {
00071 }
00072 
00073 template <typename T> 
00074 OrthogPoly<T>::
00075 ~OrthogPoly()
00076 {
00077 }
00078 
00079 template <typename T> 
00080 void
00081 OrthogPoly<T>::
00082 reset(const Teuchos::RCP<expansion_type>& expansion)
00083 {
00084   expansion_ = expansion;
00085   th->reset(expansion_->getBasis());
00086 }
00087 
00088 template <typename T> 
00089 typename OrthogPoly<T>::value_type
00090 OrthogPoly<T>::
00091 evaluate(const std::vector<typename OrthogPoly<T>::value_type>& point) const
00092 {
00093   return th->evaluate(point);
00094 }
00095 
00096 template <typename T> 
00097 typename OrthogPoly<T>::value_type
00098 OrthogPoly<T>::
00099 evaluate(const std::vector<typename OrthogPoly<T>::value_type>& point,
00100          const std::vector<typename OrthogPoly<T>::value_type>& bvals) const
00101 {
00102   return th->evaluate(point, bvals);
00103 }
00104 
00105 template <typename T> 
00106 OrthogPoly<T>& 
00107 OrthogPoly<T>::
00108 operator=(const typename OrthogPoly<T>::value_type& v) 
00109 {
00110   th.makeOwnCopy();
00111 
00112   (*th)[0] = v;
00113   Sacado::ds_array<value_type>::zero(th->coeff()+1, th->size()-1);
00114 
00115   return *this;
00116 }
00117 
00118 template <typename T> 
00119 OrthogPoly<T>& 
00120 OrthogPoly<T>::
00121 operator=(const OrthogPoly<T>& x) 
00122 {
00123   expansion_ = x.expansion_;
00124   th = x.th;
00125   return *this;
00126 }
00127 
00128 template <typename T> 
00129 OrthogPoly<T>
00130 OrthogPoly<T>::
00131 operator+() const
00132 {
00133   return *this;
00134 }
00135 
00136 template <typename T> 
00137 OrthogPoly<T> 
00138 OrthogPoly<T>::
00139 operator-() const
00140 {
00141   OrthogPoly<T> x(th->size());
00142   expansion_->unaryMinus(*(x.th), *th);
00143   return x;
00144 }
00145 
00146 template <typename T> 
00147 OrthogPoly<T>& 
00148 OrthogPoly<T>::
00149 operator+=(const typename OrthogPoly<T>::value_type& v)
00150 {
00151   th.makeOwnCopy();
00152   expansion_->plusEqual(*th, v);
00153   return *this;
00154 }
00155 
00156 template <typename T> 
00157 OrthogPoly<T>& 
00158 OrthogPoly<T>::
00159 operator-=(const typename OrthogPoly<T>::value_type& v)
00160 {
00161   th.makeOwnCopy();
00162   expansion_->minusEqual(*th, v);
00163   return *this;
00164 }
00165 
00166 template <typename T> 
00167 OrthogPoly<T>& 
00168 OrthogPoly<T>::
00169 operator*=(const typename OrthogPoly<T>::value_type& v)
00170 {
00171   th.makeOwnCopy();
00172   expansion_->timesEqual(*th, v);
00173   return *this;
00174 }
00175 
00176 template <typename T> 
00177 OrthogPoly<T>& 
00178 OrthogPoly<T>::
00179 operator/=(const typename OrthogPoly<T>::value_type& v)
00180 {
00181   th.makeOwnCopy();
00182   expansion_->divideEqual(*th, v);
00183   return *this;
00184 }
00185 
00186 template <typename T> 
00187 OrthogPoly<T>& 
00188 OrthogPoly<T>::
00189 operator+=(const OrthogPoly<T>& x)
00190 {
00191   th.makeOwnCopy();
00192   Teuchos::RCP<typename OrthogPoly<T>::expansion_type> e = expansion_;
00193   if (x.size() > size()) {
00194     e = x.expansion();
00195     reset(e);
00196   }
00197   e->plusEqual(*th, *x.th);
00198   return *this;
00199 }
00200 
00201 template <typename T> 
00202 OrthogPoly<T>& 
00203 OrthogPoly<T>::
00204 operator-=(const OrthogPoly<T>& x)
00205 {
00206   th.makeOwnCopy();
00207   Teuchos::RCP<typename OrthogPoly<T>::expansion_type> e = expansion_;
00208   if (x.size() > size()) {
00209     e = x.expansion();
00210     reset(e);
00211   }
00212   e->minusEqual(*th, *x.th);
00213   return *this;
00214 }
00215 
00216 template <typename T> 
00217 OrthogPoly<T>& 
00218 OrthogPoly<T>::
00219 operator*=(const OrthogPoly<T>& x)
00220 {
00221   th.makeOwnCopy();
00222   Teuchos::RCP<typename OrthogPoly<T>::expansion_type> e = expansion_;
00223   if (x.size() > size()) {
00224     e = x.expansion();
00225     reset(e);
00226   }
00227   e->timesEqual(*th, *x.th);
00228   return *this;
00229 }
00230 
00231 template <typename T> 
00232 OrthogPoly<T>& 
00233 OrthogPoly<T>::
00234 operator/=(const OrthogPoly<T>& x)
00235 {
00236   th.makeOwnCopy();
00237   Teuchos::RCP<typename OrthogPoly<T>::expansion_type> e = expansion_;
00238   if (x.size() > size()) {
00239     e = x.expansion();
00240     reset(e);
00241   }
00242   e->divideEqual(*th, *x.th);
00243   return *this;
00244 }
00245 
00246 template <typename T>
00247 OrthogPoly<T>
00248 operator+(const OrthogPoly<T>& a, 
00249     const OrthogPoly<T>& b)
00250 {
00251   // Get expansion
00252   typedef typename OrthogPoly<T>::ordinal_type ordinal_type;
00253   ordinal_type da = a.size();
00254   ordinal_type db = b.size();
00255   Teuchos::RCP<typename OrthogPoly<T>::expansion_type> e = a.expansion();
00256   if (da == db || da > 1)
00257     e = a.expansion();
00258   else
00259     e = b.expansion();
00260 
00261   OrthogPoly<T> c(e);
00262   e->plus(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), 
00263     b.getOrthogPolyApprox());
00264 
00265   return c;
00266 }
00267 
00268 template <typename T>
00269 OrthogPoly<T>
00270 operator+(const typename OrthogPoly<T>::value_type& a, 
00271     const OrthogPoly<T>& b)
00272 {
00273   OrthogPoly<T> c(b.expansion());
00274   b.expansion()->plus(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
00275   return c;
00276 }
00277 
00278 template <typename T>
00279 OrthogPoly<T>
00280 operator+(const OrthogPoly<T>& a, 
00281     const typename OrthogPoly<T>::value_type& b)
00282 {
00283   OrthogPoly<T> c(a.expansion());
00284   a.expansion()->plus(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
00285   return c;
00286 }
00287 
00288 template <typename T>
00289 OrthogPoly<T>
00290 operator-(const OrthogPoly<T>& a, 
00291     const OrthogPoly<T>& b)
00292 {
00293   // Get expansion
00294   typedef typename OrthogPoly<T>::ordinal_type ordinal_type;
00295   ordinal_type da = a.size();
00296   ordinal_type db = b.size();
00297   Teuchos::RCP<typename OrthogPoly<T>::expansion_type> e = a.expansion();
00298   if (da == db || da > 1)
00299     e = a.expansion();
00300   else
00301     e = b.expansion();
00302 
00303   OrthogPoly<T> c(e);
00304   e->minus(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), 
00305      b.getOrthogPolyApprox());
00306 
00307   return c;
00308 }
00309 
00310 template <typename T>
00311 OrthogPoly<T>
00312 operator-(const typename OrthogPoly<T>::value_type& a, 
00313     const OrthogPoly<T>& b)
00314 {
00315   OrthogPoly<T> c(b.expansion());
00316   b.expansion()->minus(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
00317   return c;
00318 }
00319 
00320 template <typename T>
00321 OrthogPoly<T>
00322 operator-(const OrthogPoly<T>& a, 
00323     const typename OrthogPoly<T>::value_type& b)
00324 {
00325   OrthogPoly<T> c(a.expansion());
00326   a.expansion()->minus(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
00327   return c;
00328 }
00329 
00330 template <typename T>
00331 OrthogPoly<T>
00332 operator*(const OrthogPoly<T>& a, 
00333     const OrthogPoly<T>& b)
00334 {
00335   // Get expansion
00336   typedef typename OrthogPoly<T>::ordinal_type ordinal_type;
00337   ordinal_type da = a.size();
00338   ordinal_type db = b.size();
00339   Teuchos::RCP<typename OrthogPoly<T>::expansion_type> e = a.expansion();
00340   if (da == db || da > 1)
00341     e = a.expansion();
00342   else
00343     e = b.expansion();
00344 
00345   OrthogPoly<T> c(e);
00346   e->times(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), 
00347      b.getOrthogPolyApprox());
00348 
00349   return c;
00350 }
00351 
00352 template <typename T>
00353 OrthogPoly<T>
00354 operator*(const typename OrthogPoly<T>::value_type& a, 
00355     const OrthogPoly<T>& b)
00356 {
00357   OrthogPoly<T> c(b.expansion());
00358   b.expansion()->times(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
00359   return c;
00360 }
00361 
00362 template <typename T>
00363 OrthogPoly<T>
00364 operator*(const OrthogPoly<T>& a, 
00365     const typename OrthogPoly<T>::value_type& b)
00366 {
00367   OrthogPoly<T> c(a.expansion());
00368   a.expansion()->times(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
00369   return c;
00370 }
00371 
00372 template <typename T>
00373 OrthogPoly<T>
00374 operator/(const OrthogPoly<T>& a, 
00375     const OrthogPoly<T>& b)
00376 {
00377   // Get expansion
00378   typedef typename OrthogPoly<T>::ordinal_type ordinal_type;
00379   ordinal_type da = a.size();
00380   ordinal_type db = b.size();
00381   Teuchos::RCP<typename OrthogPoly<T>::expansion_type> e = a.expansion();
00382   if (da == db || da > 1)
00383     e = a.expansion();
00384   else
00385     e = b.expansion();
00386 
00387   OrthogPoly<T> c(e);
00388   e->divide(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), 
00389       b.getOrthogPolyApprox());
00390 
00391   return c;
00392 }
00393 
00394 template <typename T>
00395 OrthogPoly<T>
00396 operator/(const typename OrthogPoly<T>::value_type& a, 
00397     const OrthogPoly<T>& b)
00398 {
00399   OrthogPoly<T> c(b.expansion());
00400   b.expansion()->divide(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
00401   return c;
00402 }
00403 
00404 template <typename T>
00405 OrthogPoly<T>
00406 operator/(const OrthogPoly<T>& a, 
00407     const typename OrthogPoly<T>::value_type& b)
00408 {
00409   OrthogPoly<T> c(a.expansion());
00410   a.expansion()->divide(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
00411   return c;
00412 }
00413 
00414 template <typename T>
00415 OrthogPoly<T>
00416 exp(const OrthogPoly<T>& a)
00417 {
00418   OrthogPoly<T> c(a.expansion());
00419   a.expansion()->exp(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00420   return c;
00421 }
00422 
00423 template <typename T>
00424 OrthogPoly<T>
00425 log(const OrthogPoly<T>& a)
00426 {
00427   OrthogPoly<T> c(a.expansion());
00428   a.expansion()->log(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00429   return c;
00430 }
00431 
00432 template <typename T>
00433 OrthogPoly<T>
00434 log10(const OrthogPoly<T>& a)
00435 {
00436   OrthogPoly<T> c(a.expansion());
00437   a.expansion()->log10(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00438   return c;
00439 }
00440 
00441 template <typename T>
00442 OrthogPoly<T>
00443 sqrt(const OrthogPoly<T>& a)
00444 {
00445   OrthogPoly<T> c(a.expansion());
00446   a.expansion()->sqrt(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00447   return c;
00448 }
00449 
00450 template <typename T>
00451 OrthogPoly<T>
00452 pow(const OrthogPoly<T>& a, 
00453     const OrthogPoly<T>& b)
00454 {
00455   // Get expansion
00456   typedef typename OrthogPoly<T>::ordinal_type ordinal_type;
00457   ordinal_type da = a.size();
00458   ordinal_type db = b.size();
00459   Teuchos::RCP<typename OrthogPoly<T>::expansion_type> e = a.expansion();
00460   if (da == db || da > 1)
00461     e = a.expansion();
00462   else
00463     e = b.expansion();
00464 
00465   OrthogPoly<T> c(e);
00466   e->pow(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), 
00467    b.getOrthogPolyApprox());
00468 
00469   return c;
00470 }
00471 
00472 template <typename T>
00473 OrthogPoly<T>
00474 pow(const T& a,
00475     const OrthogPoly<T>& b)
00476 {
00477   OrthogPoly<T> c(b.expansion());
00478   b.expansion()->pow(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
00479   return c;
00480 }
00481 
00482 template <typename T>
00483 OrthogPoly<T>
00484 pow(const OrthogPoly<T>& a,
00485     const T& b)
00486 {
00487   OrthogPoly<T> c(a.expansion());
00488   a.expansion()->pow(c.getOrthogPolyApprox(),a.getOrthogPolyApprox(), b);
00489   return c;
00490 }
00491 
00492 template <typename T>
00493 OrthogPoly<T>
00494 sin(const OrthogPoly<T>& a)
00495 {
00496   OrthogPoly<T> c(a.expansion());
00497   a.expansion()->sin(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00498   return c;
00499 }
00500 
00501 template <typename T>
00502 OrthogPoly<T>
00503 cos(const OrthogPoly<T>& a)
00504 {
00505   OrthogPoly<T> c(a.expansion());
00506   a.expansion()->cos(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00507   return c;
00508 }
00509 
00510 template <typename T>
00511 OrthogPoly<T>
00512 tan(const OrthogPoly<T>& a)
00513 {
00514   OrthogPoly<T> c(a.expansion());
00515   a.expansion()->tan(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00516   return c;
00517 }
00518 
00519 template <typename T>
00520 OrthogPoly<T>
00521 sinh(const OrthogPoly<T>& a)
00522 {
00523   OrthogPoly<T> c(a.expansion());
00524   a.expansion()->sinh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00525   return c;
00526 }
00527 
00528 template <typename T>
00529 OrthogPoly<T>
00530 cosh(const OrthogPoly<T>& a)
00531 {
00532   OrthogPoly<T> c(a.expansion());
00533   a.expansion()->cosh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00534   return c;
00535 }
00536 
00537 template <typename T>
00538 OrthogPoly<T>
00539 tanh(const OrthogPoly<T>& a)
00540 {
00541   OrthogPoly<T> c(a.expansion());
00542   a.expansion()->tanh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00543   return c;
00544 }
00545 
00546 template <typename T>
00547 OrthogPoly<T>
00548 acos(const OrthogPoly<T>& a)
00549 {
00550    OrthogPoly<T> c(a.expansion());
00551   a.expansion()->acos(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00552   return c;
00553 }
00554 
00555 template <typename T>
00556 OrthogPoly<T>
00557 asin(const OrthogPoly<T>& a)
00558 {
00559   OrthogPoly<T> c(a.expansion());
00560   a.expansion()->asin(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00561   return c;
00562 }
00563 
00564 template <typename T>
00565 OrthogPoly<T>
00566 atan(const OrthogPoly<T>& a)
00567 {
00568   OrthogPoly<T> c(a.expansion());
00569   a.expansion()->atan(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00570   return c;
00571 }
00572 
00573 template <typename T>
00574 OrthogPoly<T>
00575 acosh(const OrthogPoly<T>& a)
00576 {
00577   OrthogPoly<T> c(a.expansion());
00578   a.expansion()->acosh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00579   return c;
00580 }
00581 
00582 template <typename T>
00583 OrthogPoly<T>
00584 asinh(const OrthogPoly<T>& a)
00585 {
00586   OrthogPoly<T> c(a.expansion());
00587   a.expansion()->asinh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00588   return c;
00589 }
00590 
00591 template <typename T>
00592 OrthogPoly<T>
00593 atanh(const OrthogPoly<T>& a)
00594 {
00595   OrthogPoly<T> c(a.expansion());
00596   a.expansion()->atanh(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00597   return c;
00598 }
00599 
00600 template <typename T>
00601 OrthogPoly<T>
00602 fabs(const OrthogPoly<T>& a)
00603 {
00604   OrthogPoly<T> c(a.expansion());
00605   a.expansion()->fabs(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00606   return c;
00607 }
00608 
00609 template <typename T>
00610 OrthogPoly<T>
00611 abs(const OrthogPoly<T>& a)
00612 {
00613   OrthogPoly<T> c(a.expansion());
00614   a.expansion()->abs(c.getOrthogPolyApprox(), a.getOrthogPolyApprox());
00615   return c;
00616 }
00617 
00618 template <typename T>
00619 OrthogPoly<T>
00620 max(const OrthogPoly<T>& a,
00621     const OrthogPoly<T>& b)
00622 {
00623   // Get expansion
00624   typedef typename OrthogPoly<T>::ordinal_type ordinal_type;
00625   ordinal_type da = a.size();
00626   ordinal_type db = b.size();
00627   Teuchos::RCP<typename OrthogPoly<T>::expansion_type> e = a.expansion();
00628   if (da == db || da > 1)
00629     e = a.expansion();
00630   else
00631     e = b.expansion();
00632 
00633   OrthogPoly<T> c(e);
00634   e->max(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), 
00635    b.getOrthogPolyApprox());
00636 
00637   return c;
00638 }
00639 
00640 template <typename T>
00641 OrthogPoly<T>
00642 max(const typename OrthogPoly<T>::value_type& a,
00643     const OrthogPoly<T>& b)
00644 {
00645   OrthogPoly<T> c(b.expansion());
00646   b.expansion()->max(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
00647   return c;
00648 }
00649 
00650 template <typename T>
00651 OrthogPoly<T>
00652 max(const OrthogPoly<T>& a,
00653     const typename OrthogPoly<T>::value_type& b)
00654 {
00655   OrthogPoly<T> c(a.expansion());
00656   a.expansion()->max(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
00657   return c;
00658 }
00659 
00660 template <typename T>
00661 OrthogPoly<T>
00662 min(const OrthogPoly<T>& a,
00663     const OrthogPoly<T>& b)
00664 {
00665   // Get expansion
00666   typedef typename OrthogPoly<T>::ordinal_type ordinal_type;
00667   ordinal_type da = a.size();
00668   ordinal_type db = b.size();
00669   Teuchos::RCP<typename OrthogPoly<T>::expansion_type> e = a.expansion();
00670   if (da == db || da > 1)
00671     e = a.expansion();
00672   else
00673     e = b.expansion();
00674 
00675   OrthogPoly<T> c(e);
00676   e->min(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), 
00677    b.getOrthogPolyApprox());
00678 
00679   return c;
00680 }
00681 
00682 template <typename T>
00683 OrthogPoly<T>
00684 min(const typename OrthogPoly<T>::value_type& a,
00685     const OrthogPoly<T>& b)
00686 {
00687   OrthogPoly<T> c(b.expansion());
00688   b.expansion()->min(c.getOrthogPolyApprox(), a, b.getOrthogPolyApprox());
00689   return c;
00690 }
00691 
00692 template <typename T>
00693 OrthogPoly<T>
00694 min(const OrthogPoly<T>& a,
00695     const typename OrthogPoly<T>::value_type& b)
00696 {
00697   OrthogPoly<T> c(a.expansion());
00698   a.expansion()->min(c.getOrthogPolyApprox(), a.getOrthogPolyApprox(), b);
00699   return c;
00700 }
00701 
00702 template <typename T>
00703 bool
00704 operator==(const OrthogPoly<T>& a, 
00705      const OrthogPoly<T>& b)
00706 {
00707   return a.coeff(0) == b.coeff(0);
00708 }
00709 
00710 template <typename T>
00711 bool
00712 operator==(const typename OrthogPoly<T>::value_type& a, 
00713      const OrthogPoly<T>& b)
00714 {
00715   return a == b.coeff(0);
00716 }
00717 
00718 template <typename T>
00719 bool
00720 operator==(const OrthogPoly<T>& a, 
00721      const typename OrthogPoly<T>::value_type& b)
00722 {
00723   return a.coeff(0) == b;
00724 }
00725 
00726 template <typename T>
00727 bool
00728 operator!=(const OrthogPoly<T>& a, 
00729      const OrthogPoly<T>& b)
00730 {
00731   return a.coeff(0) != b.coeff(0);
00732 }
00733 
00734 template <typename T>
00735 bool
00736 operator!=(const typename OrthogPoly<T>::value_type& a, 
00737      const OrthogPoly<T>& b)
00738 {
00739   return a != b.coeff(0);
00740 }
00741 
00742 template <typename T>
00743 bool
00744 operator!=(const OrthogPoly<T>& a, 
00745      const typename OrthogPoly<T>::value_type& b)
00746 {
00747   return a.coeff(0) != b;
00748 }
00749 
00750 template <typename T>
00751 bool
00752 operator<=(const OrthogPoly<T>& a, 
00753      const OrthogPoly<T>& b)
00754 {
00755   return a.coeff(0) <= b.coeff(0);
00756 }
00757 
00758 template <typename T>
00759 bool
00760 operator<=(const typename OrthogPoly<T>::value_type& a, 
00761      const OrthogPoly<T>& b)
00762 {
00763   return a <= b.coeff(0);
00764 }
00765 
00766 template <typename T>
00767 bool
00768 operator<=(const OrthogPoly<T>& a, 
00769      const typename OrthogPoly<T>::value_type& b)
00770 {
00771   return a.coeff(0) <= b;
00772 }
00773 
00774 template <typename T>
00775 bool
00776 operator>=(const OrthogPoly<T>& a, 
00777      const OrthogPoly<T>& b)
00778 {
00779   return a.coeff(0) >= b.coeff(0);
00780 }
00781 
00782 template <typename T>
00783 bool
00784 operator>=(const typename OrthogPoly<T>::value_type& a, 
00785      const OrthogPoly<T>& b)
00786 {
00787   return a >= b.coeff(0);
00788 }
00789 
00790 template <typename T>
00791 bool
00792 operator>=(const OrthogPoly<T>& a, 
00793      const typename OrthogPoly<T>::value_type& b)
00794 {
00795   return a.coeff(0) >= b;
00796 }
00797 
00798 template <typename T>
00799 bool
00800 operator<(const OrthogPoly<T>& a, 
00801     const OrthogPoly<T>& b)
00802 {
00803   return a.coeff(0) < b.coeff(0);
00804 }
00805 
00806 template <typename T>
00807 bool
00808 operator<(const typename OrthogPoly<T>::value_type& a, 
00809     const OrthogPoly<T>& b)
00810 {
00811   return a < b.coeff(0);
00812 }
00813 
00814 template <typename T>
00815 bool
00816 operator<(const OrthogPoly<T>& a, 
00817     const typename OrthogPoly<T>::value_type& b)
00818 {
00819   return a.coeff(0) < b;
00820 }
00821 
00822 template <typename T>
00823 bool
00824 operator>(const OrthogPoly<T>& a, 
00825     const OrthogPoly<T>& b)
00826 {
00827   return a.coeff(0) > b.coeff(0);
00828 }
00829 
00830 template <typename T>
00831 bool
00832 operator>(const typename OrthogPoly<T>::value_type& a, 
00833     const OrthogPoly<T>& b)
00834 {
00835   return a > b.coeff(0);
00836 }
00837 
00838 template <typename T>
00839 bool
00840 operator>(const OrthogPoly<T>& a, 
00841     const typename OrthogPoly<T>::value_type& b)
00842 {
00843   return a.coeff(0) > b;
00844 }
00845 
00846 template <typename T>
00847 std::ostream& 
00848 operator << (std::ostream& os, const OrthogPoly<T>& a)
00849 {
00850   typedef typename OrthogPoly<T>::ordinal_type ordinal_type;
00851 
00852   os << "[ ";
00853       
00854   for (ordinal_type i=0; i<a.size(); i++) {
00855     os << a.coeff(i) << " ";
00856   }
00857 
00858   os << "]\n";
00859   return os;
00860 }
00861 
00862 } // namespace PCE
00863 } // namespace Sacado

Generated on Wed May 12 21:39:35 2010 for Sacado Package Browser (Single Doxygen Collection) by  doxygen 1.4.7