Teuchos - Trilinos Tools Package Version of the Day
Loading...
Searching...
No Matches
Teuchos_PolynomialTraits.hpp
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
15namespace Teuchos {
16
18
25 template <typename Scalar>
27 public:
28
30 typedef Scalar coeff_type;
31
33 typedef Scalar scalar_type;
34
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
Reference-counted pointer class and non-member templated function implementations.
Traits class for polynomial coefficients in Teuchos::Polynomial.
Scalar coeff_type
Typename of coefficients.
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
Scalar scalar_type
Typename of scalars.
static void copy(const coeff_type &x, coeff_type *y)
Copy a coefficient.
static Teuchos::RCP< coeff_type > clone(const coeff_type &c)
Clone a coefficient.
Smart reference counting pointer class for automatic garbage collection.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.