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