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 
00604 
00605 
00606 } // end namespace Thyra
00607 
00608 
00609 // /////////////////////////
00610 // Inline functions
00611 
00612 
00613 template<class Scalar>
00614 inline
00615 Scalar Thyra::scalarProd( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y )
00616 {
00617   return x.space()->scalarProd(x, y);
00618 }
00619 
00620 
00621 template<class Scalar>
00622 inline
00623 Scalar Thyra::inner( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y )
00624 {
00625   return x.space()->scalarProd(x, y);
00626 }
00627 
00628 
00629 template<class Scalar>
00630 inline
00631 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
00632 Thyra::norm( const VectorBase<Scalar>& v )
00633 {
00634   typedef Teuchos::ScalarTraits<Scalar> ST;
00635   return ST::magnitude(ST::squareroot(v.space()->scalarProd(v, v)));
00636 }
00637 
00638 
00639 #endif // THYRA_VECTOR_STD_OPS_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines