#include <solver_uv_bspline.hpp>
Definition at line 30 of file solver_uv_bspline.hpp.
solver_bspline | ( | unsigned | n, | |
unsigned | d, | |||
unsigned | N = 100 | |||
) | [inline] |
Definition at line 36 of file solver_uv_bspline.hpp.
References solver_bspline< Real >::m_c, solver_bspline< Real >::m_t, mmx::N(), and Real.
Real first_root | ( | void | ) | [inline] |
Definition at line 79 of file solver_uv_bspline.hpp.
References mmx::diff(), solver_bspline< Real >::eps, solver_bspline< Real >::insert_knot(), mmx::knotSum(), solver_bspline< Real >::m_c, solver_bspline< Real >::m_d, solver_bspline< Real >::m_k, solver_bspline< Real >::m_n, solver_bspline< Real >::m_t, mmx::max(), solver_bspline< Real >::maxn, mmx::min(), NO_ROOT, and Real.
Referenced by solver< Ring, Bspline >::first_root().
00080 { 00081 00082 unsigned k = 1; 00083 Real x = NO_ROOT; 00084 00085 for ( ; m_n < maxn; ++m_n ) { 00086 00087 while( k<m_n && (m_c[k-1]*m_c[k] > 0.0) ) 00088 ++k; 00089 00090 00091 // Off end? 00092 if ( k >= m_n ) { 00093 //if (x!= NO_ROOT) 00094 //x = -x; // NO_ROOT; 00095 x = NO_ROOT; 00096 break; 00097 } 00098 00099 // Interval converged? 00100 const Real diff = m_t[k+m_d]-m_t[k]; 00101 00102 if (diff<eps) { 00103 x = m_t[k]; 00104 break; 00105 } 00106 00107 const Real av = knotSum(m_t,k-1, m_d); 00108 const Real lambda = m_c[k-1]/(m_c[k-1]-m_c[k]); 00109 x = (av + lambda*diff)/Real(m_d); 00110 00111 // Stopping criterion 00112 const Real e = std::max(x, m_t[k+m_d-1]) - std::min(x, m_t[k+1] ); 00113 // const Real e = max(fabs(x-t[k+1]),fabs(x-t[k+m_d-1])); 00114 if (e < eps) 00115 break; 00116 00117 // Refine spline 00118 insert_knot(x,k); 00119 } 00120 00121 // dx = d*(m_c[k]-m_c[k-1])/(t[k+m_d]-t[k]); 00122 m_k = k; 00123 return x; 00124 }
int insert_knot | ( | const Real & | x, | |
int | mu | |||
) | [inline] |
Definition at line 53 of file solver_uv_bspline.hpp.
References solver_bspline< Real >::m_c, solver_bspline< Real >::m_d, solver_bspline< Real >::m_n, solver_bspline< Real >::m_t, mmx::max(), and Real.
Referenced by solver_bspline< Real >::first_root().
00054 { 00055 mu = std::max(mu,m_d); 00056 while ( x>=m_t[mu+1]) mu++; 00057 00058 for ( int i=m_n; i>mu; i--) { 00059 m_c[i] = m_c[i-1]; 00060 } 00061 00062 for ( int i=mu; i>=mu-m_d+1; i--) { 00063 const Real alpha = (x-m_t[i])/(m_t[i+m_d]-m_t[i]); 00064 m_c[i] = (1.0-alpha) * m_c[i-1] + alpha * m_c[i]; 00065 } 00066 00067 m_t[m_n+m_d] = 1.0; 00068 00069 for ( int i=m_n; i>mu+1; --i) 00070 m_t[i] = m_t[i-1]; 00071 m_t[mu+1] = x; 00072 00073 // n++; 00074 return mu; 00075 }
Real eps |
Definition at line 34 of file solver_uv_bspline.hpp.
Referenced by solver_bspline< Real >::first_root().
Real * m_c |
Definition at line 31 of file solver_uv_bspline.hpp.
Referenced by solver< Ring, Bspline >::first_root(), solver_bspline< Real >::first_root(), solver_bspline< Real >::insert_knot(), and solver_bspline< Real >::solver_bspline().
int m_d |
Definition at line 33 of file solver_uv_bspline.hpp.
Referenced by solver_bspline< Real >::first_root(), and solver_bspline< Real >::insert_knot().
unsigned m_k |
Definition at line 32 of file solver_uv_bspline.hpp.
Referenced by solver_bspline< Real >::first_root().
unsigned m_n |
Definition at line 32 of file solver_uv_bspline.hpp.
Referenced by solver_bspline< Real >::first_root(), and solver_bspline< Real >::insert_knot().
Real* m_t |
Definition at line 31 of file solver_uv_bspline.hpp.
Referenced by solver< Ring, Bspline >::first_root(), solver_bspline< Real >::first_root(), solver_bspline< Real >::insert_knot(), and solver_bspline< Real >::solver_bspline().
unsigned maxn |
Definition at line 32 of file solver_uv_bspline.hpp.
Referenced by solver_bspline< Real >::first_root().