Thyra Version of the Day
Thyra_VectorStdOps_decl.hpp
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //    Thyra: Interfaces and Support for Abstract Numerical Algorithms
00005 //                 Copyright (2004) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 
00043 #ifndef THYRA_VECTOR_STD_OPS_DECL_HPP
00044 #define THYRA_VECTOR_STD_OPS_DECL_HPP
00045 
00046 
00047 #include "Thyra_OperatorVectorTypes.hpp"
00048 
00049 
00050 namespace Thyra {
00051 
00052 
00058 template<class Scalar>
00059 Scalar sum( const VectorBase<Scalar>& v );
00060 
00061 
00068 template<class Scalar>
00069 Scalar scalarProd( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y );
00070 
00071 
00078 template<class Scalar>
00079 Scalar inner( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y );
00080 
00081 
00089 template<class Scalar>
00090 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
00091 norm( const VectorBase<Scalar>& v );
00092 
00093 
00098 template<class Scalar>
00099 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
00100 norm_1( const VectorBase<Scalar>& v );
00101 
00102 
00107 template<class Scalar>
00108 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
00109 norm_2( const VectorBase<Scalar>& v );
00110 
00111 
00117 template<class Scalar>
00118 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
00119 norm_2( const VectorBase<Scalar> &w, const VectorBase<Scalar>& v );
00120 
00121 
00126 template<class Scalar>
00127 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
00128 norm_inf( const VectorBase<Scalar>& v_rhs );
00129 
00130 
00135 template<class Scalar>
00136 Scalar dot( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y );
00137 
00138 
00143 template<class Scalar>
00144 Scalar get_ele( const VectorBase<Scalar>& v, Ordinal i );
00145 
00146 
00151 template<class Scalar>
00152 void set_ele( Ordinal i, Scalar alpha, const Ptr<VectorBase<Scalar> > &v );
00153 
00154 
00160 template<class Scalar>
00161 void put_scalar( const Scalar& alpha, const Ptr<VectorBase<Scalar> > &y );
00162 
00163 
00169 template<class Scalar>
00170 void copy( const VectorBase<Scalar>& x, const Ptr<VectorBase<Scalar> > &y );
00171 
00172 
00178 template<class Scalar>
00179 void add_scalar( const Scalar& alpha, const Ptr<VectorBase<Scalar> > &y );
00180 
00181 
00191 template<class Scalar>
00192 void scale( const Scalar& alpha, const Ptr<VectorBase<Scalar> > &y );
00193 
00194 
00200 template<class Scalar>
00201 void abs( const VectorBase<Scalar> &x, const Ptr<VectorBase<Scalar> > &y );
00202 
00203 
00209 template<class Scalar>
00210 void reciprocal( const VectorBase<Scalar> &x, const Ptr<VectorBase<Scalar> > &y );
00211 
00212 
00218 template<class Scalar>
00219 void ele_wise_prod( const Scalar& alpha, const VectorBase<Scalar>& x,
00220   const VectorBase<Scalar>& v, const Ptr<VectorBase<Scalar> > &y );
00221 
00222 
00228 template<class Scalar>
00229 void ele_wise_conj_prod( const Scalar& alpha, const VectorBase<Scalar>& x,
00230   const VectorBase<Scalar>& v, const Ptr<VectorBase<Scalar> > &y );
00231 
00232 
00238 template<class Scalar>
00239 void ele_wise_scale( const VectorBase<Scalar>& x, const Ptr<VectorBase<Scalar> > &y );
00240 
00241 
00247 template<class Scalar>
00248 void Vp_StVtV( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha,
00249   const VectorBase<Scalar>& x, const VectorBase<Scalar>& v);
00250 
00251 
00257 template<class Scalar>
00258 void ele_wise_prod_update( const Scalar& alpha, const VectorBase<Scalar>& x,
00259   const Ptr<VectorBase<Scalar> > &y );
00260 
00261 
00267 template<class Scalar>
00268 void Vt_StV( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha,
00269   const VectorBase<Scalar> &x );
00270 
00271 
00277 template<class Scalar>
00278 void ele_wise_divide( const Scalar& alpha, const VectorBase<Scalar>& x,
00279   const VectorBase<Scalar>& v, const Ptr<VectorBase<Scalar> > &y );
00280 
00281 
00304 template<class Scalar>
00305 void linear_combination(
00306   const ArrayView<const Scalar> &alpha,
00307   const ArrayView<const Ptr<const VectorBase<Scalar> > > &x,
00308   const Scalar &beta,
00309   const Ptr<VectorBase<Scalar> > &y
00310   );
00311 
00312 
00322 template<class Scalar>
00323 void seed_randomize( unsigned int s );
00324 
00325 
00336 template<class Scalar>
00337 void randomize( Scalar l, Scalar u, const Ptr<VectorBase<Scalar> > &v );
00338 
00339 
00345 template<class Scalar>
00346 void assign( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha );
00347 
00348 
00354 template<class Scalar>
00355 void assign( const Ptr<VectorBase<Scalar> > &y, const VectorBase<Scalar>& x );
00356 
00357 
00363 template<class Scalar>
00364 void Vp_S( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha );
00365 
00366 
00376 template<class Scalar>
00377 void Vt_S( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha );
00378 
00379 
00385 template<class Scalar>
00386 void V_StV( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha,
00387   const VectorBase<Scalar> &x );
00388 
00389 
00395 template<class Scalar>
00396 void Vp_StV( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha,
00397   const VectorBase<Scalar>& x );
00398 
00399 
00404 template<class Scalar>
00405 void Vp_V(
00406   const Ptr<VectorBase<Scalar> > &y, const VectorBase<Scalar>& x,
00407   const Scalar& beta = static_cast<Scalar>(1.0)
00408   );
00409 
00410 
00415 template<class Scalar>
00416 void V_V( const Ptr<VectorBase<Scalar> > &y, const VectorBase<Scalar>& x );
00417 
00418 
00423 template<class Scalar>
00424 void V_S( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha );
00425 
00426 
00431 template<class Scalar>
00432 void V_VpV( const Ptr<VectorBase<Scalar> > &z, const VectorBase<Scalar>& x,
00433   const VectorBase<Scalar>& y );
00434 
00435 
00440 template<class Scalar>
00441 void V_VmV( const Ptr<VectorBase<Scalar> > &z, const VectorBase<Scalar>& x,
00442   const VectorBase<Scalar>& y );
00443 
00444 
00449 template<class Scalar>
00450 void V_StVpV( const Ptr<VectorBase<Scalar> > &z, const Scalar &alpha,
00451   const VectorBase<Scalar>& x, const VectorBase<Scalar>& y );
00452 
00453 
00458 template<class Scalar>
00459 void V_VpStV( const Ptr<VectorBase<Scalar> > &z,
00460   const VectorBase<Scalar>& x,
00461   const Scalar &alpha, const VectorBase<Scalar>& y );
00462 
00463 
00468 template<class Scalar>
00469 void V_StVpStV( const Ptr<VectorBase<Scalar> > &z, const Scalar &alpha,
00470   const VectorBase<Scalar>& x, const Scalar &beta, const VectorBase<Scalar>& y );
00471 
00472 
00477 template<class Scalar>
00478 Scalar min( const VectorBase<Scalar>& x );
00479 
00480 
00500 template<class Scalar>
00501 void min( const VectorBase<Scalar>& x,
00502   const Ptr<Scalar> &maxEle, const Ptr<Ordinal> &maxIndex );
00503 
00504 
00534 template<class Scalar>
00535 void minGreaterThanBound( const VectorBase<Scalar>& x, const Scalar &bound,
00536   const Ptr<Scalar> &minEle, const Ptr<Ordinal> &minIndex );
00537 
00538 
00543 template<class Scalar>
00544 Scalar max( const VectorBase<Scalar>& x );
00545 
00546 
00566 template<class Scalar>
00567 void max( const VectorBase<Scalar>& x,
00568   const Ptr<Scalar> &maxEle, const Ptr<Ordinal> &maxIndex );
00569 
00570 
00599 template<class Scalar>
00600 void maxLessThanBound( const VectorBase<Scalar>& x, const Scalar &bound,
00601   const Ptr<Scalar> &maxEle, const Ptr<Ordinal> &maxIndex );
00602 
00603 
00605 template<class Scalar>
00606 THYRA_DEPRECATED
00607 void set_ele( Ordinal i, Scalar alpha, VectorBase<Scalar>* v )
00608 { set_ele(i, alpha, Teuchos::ptr(v)); }
00609 
00610 
00612 template<class Scalar> inline
00613 THYRA_DEPRECATED
00614 void put_scalar( const Scalar& alpha, VectorBase<Scalar>* y )
00615 { put_scalar<Scalar>(alpha,Teuchos::ptr(y)); }
00616 
00617 
00619 template<class Scalar> inline
00620 THYRA_DEPRECATED
00621 void copy( const VectorBase<Scalar>& x, VectorBase<Scalar>* y )
00622 { copy(x,Teuchos::ptr(y)); }
00623 
00624 
00626 template<class Scalar> inline
00627 THYRA_DEPRECATED
00628 void add_scalar( const Scalar& alpha, VectorBase<Scalar>* y )
00629 { add_scalar(alpha,Teuchos::ptr(y)); }
00630 
00631 
00633 template<class Scalar> inline
00634 THYRA_DEPRECATED
00635 void scale( const Scalar& alpha, VectorBase<Scalar>* y )
00636 { scale(alpha,Teuchos::ptr(y)); }
00637 
00638 
00640 template<class Scalar> inline
00641 THYRA_DEPRECATED
00642 void abs( VectorBase<Scalar>* y, const VectorBase<Scalar>& x )
00643 { abs(Teuchos::ptr(y),x); }
00644 
00645 
00647 template<class Scalar>
00648 THYRA_DEPRECATED
00649 void abs( const Ptr<VectorBase<Scalar> > &y, const VectorBase<Scalar> &x )
00650 {
00651   abs<Scalar>( x, y );
00652 }
00653 
00654 
00656 template<class Scalar> inline
00657 THYRA_DEPRECATED
00658 void reciprocal( VectorBase<Scalar>* y, const VectorBase<Scalar>& x )
00659 { reciprocal(Teuchos::ptr(y),x); }
00660 
00661 
00663 template<class Scalar>
00664 THYRA_DEPRECATED
00665 void reciprocal( const Ptr<VectorBase<Scalar> > &y, const VectorBase<Scalar> &x )
00666 {
00667   reciprocal<Scalar>( x, y );
00668 }
00669 
00670 
00672 template<class Scalar> inline
00673 THYRA_DEPRECATED
00674 void ele_wise_prod( const Scalar& alpha, const VectorBase<Scalar>& x,
00675   const VectorBase<Scalar>& v, VectorBase<Scalar>* y )
00676 { ele_wise_prod(alpha, x, v, Teuchos::ptr(y)); }
00677 
00678 
00680 template<class Scalar> inline
00681 THYRA_DEPRECATED
00682 void ele_wise_conj_prod( const Scalar& alpha, const VectorBase<Scalar>& x,
00683   const VectorBase<Scalar>& v, VectorBase<Scalar>* y )
00684 { ele_wise_conj_prod(alpha,x,v,Teuchos::ptr(y)); }
00685 
00686 
00688 template<class Scalar> inline
00689 THYRA_DEPRECATED
00690 void Vp_StVtV( VectorBase<Scalar>* y, const Scalar& alpha,
00691   const VectorBase<Scalar>& x, const VectorBase<Scalar>& v)
00692 { Vp_StVtV(Teuchos::ptr(y),alpha,x,v); }
00693 
00694 
00696 template<class Scalar> inline
00697 THYRA_DEPRECATED
00698 void ele_wise_prod_update( const Scalar& alpha, const VectorBase<Scalar>& x,
00699   VectorBase<Scalar>* y )
00700 { ele_wise_prod_update(alpha,x,Teuchos::ptr(y)); }
00701 
00702 
00704 template<class Scalar> inline
00705 THYRA_DEPRECATED
00706 void Vt_StV( VectorBase<Scalar>* y, const Scalar& alpha,
00707   const VectorBase<Scalar> &x )
00708 { Vt_StV(Teuchos::ptr(y),alpha,x); }
00709 
00710 
00712 template<class Scalar>
00713 THYRA_DEPRECATED
00714 void ele_wise_divide( const Scalar& alpha, const VectorBase<Scalar>& x,
00715   const VectorBase<Scalar>& v, VectorBase<Scalar>* y )
00716 { ele_wise_divide(alpha,x,v,Teuchos::ptr(y)); }
00717 
00718 
00720 template<class Scalar>
00721 THYRA_DEPRECATED
00722 void linear_combination(
00723   const int m
00724   ,const Scalar alpha_in[]
00725   ,const VectorBase<Scalar>* x_in[]
00726   ,const Scalar &beta
00727   ,VectorBase<Scalar> *y
00728   )
00729 {
00730   Array<Scalar> alpha(m);
00731   Array<Ptr<const VectorBase<Scalar> > > x(m);
00732   for (int k = 0; k < m; ++k) {
00733     alpha[k] = alpha_in[k];
00734     x[k] = Teuchos::ptr(x_in[k]);
00735   }
00736   linear_combination<Scalar>( alpha, x, beta, Teuchos::ptr(y) );
00737 }
00738 
00739 
00741 template<class Scalar> inline
00742 THYRA_DEPRECATED
00743 void randomize( Scalar l, Scalar u, VectorBase<Scalar>* v )
00744 { randomize(l,u,Teuchos::ptr(v)); }
00745 
00746 
00748 template<class Scalar> inline
00749 THYRA_DEPRECATED
00750 void assign( VectorBase<Scalar>* y, const Scalar& alpha )
00751 { assign(Teuchos::ptr(y),alpha); }
00752 
00753 
00755 template<class Scalar>
00756 THYRA_DEPRECATED
00757 void assign( VectorBase<Scalar>* y, const VectorBase<Scalar>& x )
00758 { assign(Teuchos::ptr(y), x); }
00759 
00760 
00762 template<class Scalar>
00763 THYRA_DEPRECATED
00764 void Vp_S( VectorBase<Scalar>* y, const Scalar& alpha )
00765 { Vp_S(Teuchos::ptr(y), alpha); }
00766 
00767 
00769 template<class Scalar>
00770 THYRA_DEPRECATED
00771 void Vt_S( VectorBase<Scalar>* y, const Scalar& alpha )
00772 { Vt_S(Teuchos::ptr(y), alpha); }
00773 
00774 
00776 template<class Scalar>
00777 THYRA_DEPRECATED
00778 void V_StV( VectorBase<Scalar>* y, const Scalar& alpha,
00779   const VectorBase<Scalar> &x )
00780 { V_StV(Teuchos::ptr(y), alpha, x); }
00781 
00782 
00784 template<class Scalar>
00785 THYRA_DEPRECATED
00786 void Vp_StV( VectorBase<Scalar>* y, const Scalar& alpha,
00787   const VectorBase<Scalar>& x )
00788 { Vp_StV(Teuchos::ptr(y), alpha, x); }
00789 
00790 
00792 template<class Scalar>
00793 THYRA_DEPRECATED
00794 void Vp_V(
00795   VectorBase<Scalar>* y, const VectorBase<Scalar>& x,
00796   const Scalar& beta = static_cast<Scalar>(1.0)
00797   )
00798 { Vp_V(Teuchos::ptr(y), x, beta); }
00799 
00800 
00802 template<class Scalar>
00803 THYRA_DEPRECATED
00804 void V_V( VectorBase<Scalar>* y, const VectorBase<Scalar>& x )
00805 { V_V(Teuchos::ptr(y), x); }
00806 
00807 
00809 template<class Scalar>
00810 THYRA_DEPRECATED
00811 void V_S( VectorBase<Scalar>* y, const Scalar& alpha )
00812 { V_S(Teuchos::ptr(y), alpha); }
00813 
00814 
00816 template<class Scalar>
00817 THYRA_DEPRECATED
00818 void V_VpV( VectorBase<Scalar>* z, const VectorBase<Scalar>& x,
00819   const VectorBase<Scalar>& y )
00820 { V_VpV(Teuchos::ptr(z), x, y); }
00821 
00822 
00824 template<class Scalar>
00825 THYRA_DEPRECATED
00826 void V_VmV( VectorBase<Scalar>* z, const VectorBase<Scalar>& x,
00827   const VectorBase<Scalar>& y )
00828 { V_VmV(Teuchos::ptr(z), x, y); }
00829 
00830 
00832 template<class Scalar>
00833 THYRA_DEPRECATED
00834 void V_StVpV( VectorBase<Scalar>* z, const Scalar &alpha,
00835   const VectorBase<Scalar>& x, const VectorBase<Scalar>& y )
00836 { V_StVpV(Teuchos::ptr(z), alpha, x, y); }
00837 
00838 
00840 template<class Scalar>
00841 THYRA_DEPRECATED
00842 void V_StVpStV( VectorBase<Scalar>* z, const Scalar &alpha,
00843   const VectorBase<Scalar>& x, const Scalar &beta, const VectorBase<Scalar>& y )
00844 { V_StVpStV(Teuchos::ptr(z), alpha, x, beta, y); }
00845 
00846 
00848 template<class Scalar>
00849 THYRA_DEPRECATED
00850 void min( const VectorBase<Scalar>& x, Scalar *maxEle, Ordinal *maxIndex )
00851 { min(x, Teuchos::ptr(maxEle), Teuchos::ptr(maxIndex)); }
00852 
00853 
00855 template<class Scalar>
00856 THYRA_DEPRECATED
00857 void minGreaterThanBound( const VectorBase<Scalar>& x, const Scalar &bound,
00858   Scalar *minEle, Ordinal *minIndex )
00859 { minGreaterThanBound(x, bound, Teuchos::ptr(minEle), Teuchos::ptr(minIndex)); }
00860 
00861 
00863 template<class Scalar>
00864 THYRA_DEPRECATED
00865 void max( const VectorBase<Scalar>& x, Scalar *maxEle, Ordinal *maxIndex )
00866 { max(x, Teuchos::ptr(maxEle), Teuchos::ptr(maxIndex)); }
00867 
00868 
00870 template<class Scalar>
00871 THYRA_DEPRECATED
00872 void maxLessThanBound( const VectorBase<Scalar>& x, const Scalar &bound,
00873   Scalar *maxEle, Ordinal *maxIndex )
00874 { maxLessThanBound(x, bound, Teuchos::ptr(maxEle), Teuchos::ptr(maxIndex)); }
00875 
00876 
00877 } // end namespace Thyra
00878 
00879 
00880 // /////////////////////////
00881 // Inline functions
00882 
00883 
00884 template<class Scalar>
00885 inline
00886 Scalar Thyra::scalarProd( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y )
00887 {
00888   return x.space()->scalarProd(x, y);
00889 }
00890 
00891 
00892 template<class Scalar>
00893 inline
00894 Scalar Thyra::inner( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y )
00895 {
00896   return x.space()->scalarProd(x, y);
00897 }
00898 
00899 
00900 template<class Scalar>
00901 inline
00902 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
00903 Thyra::norm( const VectorBase<Scalar>& v )
00904 {
00905   typedef Teuchos::ScalarTraits<Scalar> ST;
00906   return ST::magnitude(ST::squareroot(v.space()->scalarProd(v, v)));
00907 }
00908 
00909 
00910 #endif // THYRA_VECTOR_STD_OPS_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines