Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_PolynomialTraits.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TEUCHOS_POLYNOMIAL_TRAITS_HPP
11 #define TEUCHOS_POLYNOMIAL_TRAITS_HPP
12 
13 #include "Teuchos_RCP.hpp"
14 
15 namespace Teuchos {
16 
18 
25  template <typename Scalar>
27  public:
28 
30  typedef Scalar coeff_type;
31 
34 
36  static inline Teuchos::RCP<coeff_type> clone(const coeff_type& c) {
37  return Teuchos::rcp(new coeff_type(c));
38  }
39 
41  static inline void copy(const coeff_type& x, coeff_type* y) {
42  *y = x;
43  }
44 
46  static inline void assign(coeff_type* y, const scalar_type& alpha) {
47  *y = alpha;
48  }
49 
51  static inline void update(coeff_type* y, const coeff_type& x,
52  const scalar_type& beta) {
53  *y = x + beta*(*y);
54  }
55 
56  }; // class PolynomialTraits
57 
58 } // end namespace Teuchos
59 
60 #endif // TEUCHOS_POLYNOMIAL_TRAITS_HPP
static void assign(coeff_type *y, const scalar_type &alpha)
Assign a scalar to a coefficient.
static void update(coeff_type *y, const coeff_type &x, const scalar_type &beta)
y = x + beta*y
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
Scalar scalar_type
Typename of scalars.
static Teuchos::RCP< coeff_type > clone(const coeff_type &c)
Clone a coefficient.
Scalar coeff_type
Typename of coefficients.
Traits class for polynomial coefficients in Teuchos::Polynomial.
Smart reference counting pointer class for automatic garbage collection.
static void copy(const coeff_type &x, coeff_type *y)
Copy a coefficient.
Reference-counted pointer class and non-member templated function implementations.