BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
fn_ddpolyval.hpp
Go to the documentation of this file.
1/*
2 * BELFEM -- The Berkeley Lab Finite Element Framework
3 * Copyright (c) 2026, The Regents of the University of California,
4 * through Lawrence Berkeley National Laboratory (subject to receipt of any required
5 * approvals from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * Developers: Christian Messe, Gregory Giard
8 *
9 * See the top-level LICENSE file for the complete license and disclaimer.
10 */
11
23
24#ifndef BELFEM_FN_DDPOLYVAL_HPP
25#define BELFEM_FN_DDPOLYVAL_HPP
26
27#include "typedefs.hpp"
28#include "cl_Vector.hpp"
29
30namespace belfem
31{
44 template < typename T >
45 T
46 ddpolyval( const Vector< T > & aCoeffs, const T aX )
47 {
48 const index_t tN = aCoeffs.length() - 1;
49 if ( tN < 2 )
50 {
51 return ( T ) 0;
52 }
53 T tPow = ( T ) tN;
54 T aResult = tPow * ( tPow - ( T ) 1 ) * aCoeffs( 0 );
55 for( index_t k=1; k < tN - 1; ++k )
56 {
57 aResult *= aX;
58 tPow -= ( T ) 1;
59 aResult += tPow * ( tPow - ( T ) 1 ) * aCoeffs( k );
60 }
61 return aResult;
62 }
63}
64#endif //BELFEM_FN_DDPOLYVAL_HPP
Column vector.
Definition cl_BZ_Vector.hpp:41
size_t length() const
get the length of the vector
Definition cl_AR_Vector.hpp:257
T ddpolyval(const Vector< T > &aCoeffs, const T aX)
Evaluates the second derivative of a polynomial at one point.
Definition fn_ddpolyval.hpp:46
USER GUIDES:
Definition cl_Capacitor.cpp:16
@ T
Definition cl_Material.hpp:122
uint32_t index_t
Definition typedefs.hpp:52