KrisLibrary  1.0.0
interpolate.h
Go to the documentation of this file.
1 #ifndef INTERPOLATE_H
2 #define INTERPOLATE_H
3 
4 #include "VectorTemplate.h"
5 #include "MatrixTemplate.h"
6 
15 
16 namespace Math {
17 
18 template <class type>
19 void interpolate(const type& a, const type& b, Real u, type& x)
20 {
21  x=(One-u)*a + u*b;
22 }
23 
24 
25 template <class T>
26 void interpolate(const VectorTemplate<T>& a, const VectorTemplate<T>& b, Real u, VectorTemplate<T>& x)
27 {
28  x.resize(a.n);
29  x.mul(a,(One-u));
30  x.madd(b,u);
31 }
32 
33 template <class T>
34 void interpolate(const MatrixTemplate<T>& a, const MatrixTemplate<T>& b, Real u, MatrixTemplate<T>& x)
35 {
36  x.resize(a.m,a.n);
37  x.mul(a,(One-u));
38  x.madd(b,u);
39 }
40 
41 } //namespace Math
42 
45 #endif
Contains all definitions in the Math package.
Definition: WorkspaceBound.h:12