2020-06-28 23:07:29 +08:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv = "Content-Type" content = "text/xhtml;charset=UTF-8" / >
< meta http-equiv = "X-UA-Compatible" content = "IE=9" / >
< meta name = "generator" content = "Doxygen 1.8.18" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > Algorithms_in_C: numerical_methods/durand_kerner_roots.c File Reference< / title >
< link href = "../../tabs.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "../../jquery.js" > < / script >
< script type = "text/javascript" src = "../../dynsections.js" > < / script >
< link href = "../../navtree.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "../../resize.js" > < / script >
< script type = "text/javascript" src = "../../navtreedata.js" > < / script >
< script type = "text/javascript" src = "../../navtree.js" > < / script >
< link href = "../../search/search.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "../../search/searchdata.js" > < / script >
< script type = "text/javascript" src = "../../search/search.js" > < / script >
< script type = "text/x-mathjax-config" >
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
< / script >
< script type = "text/javascript" async = "async" src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js" > < / script >
< link href = "../../doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< div id = "top" > <!-- do not remove this div, it is closed by doxygen! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
< tr style = "height: 56px;" >
< td id = "projectalign" style = "padding-left: 0.5em;" >
< div id = "projectname" > Algorithms_in_C
  < span id = "projectnumber" > 1.0.0< / span >
< / div >
< div id = "projectbrief" > Set of algorithms implemented in C.< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3& dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
/* @license-end */
< / script >
< script type = "text/javascript" src = "../../menudata.js" > < / script >
< script type = "text/javascript" src = "../../menu.js" > < / script >
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3& dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */< / script >
< div id = "main-nav" > < / div >
< / div > <!-- top -->
< div id = "side-nav" class = "ui-resizable side-nav-resizable" >
< div id = "nav-tree" >
< div id = "nav-tree-contents" >
< div id = "nav-sync" class = "sync" > < / div >
< / div >
< / div >
< div id = "splitbar" style = "-moz-user-select:none;"
class="ui-resizable-handle">
< / div >
< / div >
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3& dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('da/d38/durand__kerner__roots_8c.html','../../'); initResizable(); });
/* @license-end */
< / script >
< div id = "doc-content" >
<!-- window showing the filter options -->
< div id = "MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
< / div >
<!-- iframe showing the search results (closed by default) -->
< div id = "MSearchResultsWindow" >
< iframe src = "javascript:void(0)" frameborder = "0"
name="MSearchResults" id="MSearchResults">
< / iframe >
< / div >
< div class = "header" >
< div class = "summary" >
< a href = "#define-members" > Macros< / a > |
< a href = "#func-members" > Functions< / a > < / div >
< div class = "headertitle" >
< div class = "title" > durand_kerner_roots.c File Reference< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
< p > Compute all possible approximate roots of any given polynomial using < a href = "https://en.wikipedia.org/wiki/Durand%E2%80%93Kerner_method" > Durand Kerner algorithm< / a >
< a href = "#details" > More...< / a > < / p >
< div class = "textblock" > < code > #include < complex.h> < / code > < br / >
< code > #include < limits.h> < / code > < br / >
< code > #include < math.h> < / code > < br / >
< code > #include < stdio.h> < / code > < br / >
< code > #include < stdlib.h> < / code > < br / >
< code > #include < string.h> < / code > < br / >
< code > #include < time.h> < / code > < br / >
< / div > < div class = "textblock" > < div class = "dynheader" >
Include dependency graph for durand_kerner_roots.c:< / div >
< div class = "dyncontent" >
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../db/dff/durand__kerner__roots_8c__incl.svg" width = "616" height = "127" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
< / div >
< / div >
< / div > < table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a name = "define-members" > < / a >
Macros< / h2 > < / td > < / tr >
2020-06-29 04:40:24 +08:00
< tr class = "memitem:af270a96662132d0385cb6b4637c5a689" > < td class = "memItemLeft" align = "right" valign = "top" > < a id = "af270a96662132d0385cb6b4637c5a689" > < / a >
#define  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../da/d38/durand__kerner__roots_8c.html#af270a96662132d0385cb6b4637c5a689" > ACCURACY< / a >       1e-10< / td > < / tr >
< tr class = "memdesc:af270a96662132d0385cb6b4637c5a689" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > maximum accuracy limit < br / > < / td > < / tr >
2020-06-28 23:07:29 +08:00
< tr class = "separator:af270a96662132d0385cb6b4637c5a689" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table > < table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a name = "func-members" > < / a >
Functions< / h2 > < / td > < / tr >
< tr class = "memitem:adf4ae062a028c6faf2b96c9c1eb343af" > < td class = "memItemLeft" align = "right" valign = "top" > long double complex  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../da/d38/durand__kerner__roots_8c.html#adf4ae062a028c6faf2b96c9c1eb343af" > poly_function< / a > (double *coeffs, unsigned int degree, long double complex x)< / td > < / tr >
2020-06-29 04:40:24 +08:00
< tr class = "memdesc:adf4ae062a028c6faf2b96c9c1eb343af" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Evaluate the value of a polynomial with given coefficients. < a href = "../../da/d38/durand__kerner__roots_8c.html#adf4ae062a028c6faf2b96c9c1eb343af" > More...< / a > < br / > < / td > < / tr >
2020-06-28 23:07:29 +08:00
< tr class = "separator:adf4ae062a028c6faf2b96c9c1eb343af" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:afa5b04ce11475d67049cba8273741fb7" > < td class = "memItemLeft" align = "right" valign = "top" > const char *  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../da/d38/durand__kerner__roots_8c.html#afa5b04ce11475d67049cba8273741fb7" > complex_str< / a > (long double complex x)< / td > < / tr >
2020-06-29 04:40:24 +08:00
< tr class = "memdesc:afa5b04ce11475d67049cba8273741fb7" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > create a textual form of complex number < a href = "../../da/d38/durand__kerner__roots_8c.html#afa5b04ce11475d67049cba8273741fb7" > More...< / a > < br / > < / td > < / tr >
2020-06-28 23:07:29 +08:00
< tr class = "separator:afa5b04ce11475d67049cba8273741fb7" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a26d5695ebed0818a3e7cf4b10aacab52" > < td class = "memItemLeft" align = "right" valign = "top" > char  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../da/d38/durand__kerner__roots_8c.html#a26d5695ebed0818a3e7cf4b10aacab52" > check_termination< / a > (long double delta)< / td > < / tr >
2020-06-29 04:40:24 +08:00
< tr class = "memdesc:a26d5695ebed0818a3e7cf4b10aacab52" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > check for termination condition < a href = "../../da/d38/durand__kerner__roots_8c.html#a26d5695ebed0818a3e7cf4b10aacab52" > More...< / a > < br / > < / td > < / tr >
2020-06-28 23:07:29 +08:00
< tr class = "separator:a26d5695ebed0818a3e7cf4b10aacab52" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a3c04138a5bfe5d72780bb7e82a18e627" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../da/d38/durand__kerner__roots_8c.html#a3c04138a5bfe5d72780bb7e82a18e627" > main< / a > (int argc, char **argv)< / td > < / tr >
< tr class = "separator:a3c04138a5bfe5d72780bb7e82a18e627" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table >
< a name = "details" id = "details" > < / a > < h2 class = "groupheader" > Detailed Description< / h2 >
< div class = "textblock" > < p > Compute all possible approximate roots of any given polynomial using < a href = "https://en.wikipedia.org/wiki/Durand%E2%80%93Kerner_method" > Durand Kerner algorithm< / a > < / p >
< dl class = "section author" > < dt > Author< / dt > < dd > < a href = "https://github.com/kvedala" > Krishna Vedala< / a > < / dd > < / dl >
< p > Test the algorithm online: < a href = "https://gist.github.com/kvedala/27f1b0b6502af935f6917673ec43bcd7" > https://gist.github.com/kvedala/27f1b0b6502af935f6917673ec43bcd7< / a > < / p >
< p > Try the highly unstable Wilkinson's polynomial: < / p > < div class = "fragment" > < div class = "line" > ./numerical_methods/durand_kerner_roots.c 1 -210 20615 -1256850 53327946< / div >
< div class = "line" > -1672280820 40171771630 -756111184500 11310276995381 -135585182899530< / div >
< div class = "line" > 1307535010540395 -10142299865511450 63030812099294896 -311333643161390640< / div >
< div class = "line" > 1206647803780373360 -3599979517947607200 8037811822645051776< / div >
< div class = "line" > -12870931245150988800 13803759753640704000 -8752948036761600000< / div >
< div class = "line" > 2432902008176640000< / div >
< / div > <!-- fragment --> < p > Sample implementation results to compute approximate roots of the equation \(x^4-1=0\):< br / >
2020-06-28 23:30:37 +08:00
< img src = "https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/numerical_methods/durand_kerner_error.svg" alt = "Error evolution during root approximations computed every
iteration." style="pointer-events: none;" width="400" class="inline"/> < img src = "https://raw.githubusercontent.com/TheAlgorithms/C/docs/images/numerical_methods/durand_kerner_roots.svg" alt = "Roots evolution - shows the initial approximation of the
2020-06-28 23:07:29 +08:00
roots and their convergence to a final approximation along with the iterative
approximations" style="pointer-events: none;" width="400" class="inline"/> < / p >
2020-06-29 04:40:24 +08:00
< / div > < h2 class = "groupheader" > Function Documentation< / h2 >
2020-06-28 23:07:29 +08:00
< a id = "a26d5695ebed0818a3e7cf4b10aacab52" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a26d5695ebed0818a3e7cf4b10aacab52" > ◆ < / a > < / span > check_termination()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > char check_termination < / td >
< td > (< / td >
< td class = "paramtype" > long double  < / td >
< td class = "paramname" > < em > delta< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
2020-06-29 04:40:24 +08:00
< p > check for termination condition < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
2020-06-28 23:07:29 +08:00
< table class = "params" >
< tr > < td class = "paramdir" > [in]< / td > < td class = "paramname" > delta< / td > < td > point at which to evaluate the polynomial < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > 0 if termination not reached < / dd >
< dd >
1 if termination reached < / dd > < / dl >
2020-06-28 23:30:37 +08:00
< div class = "fragment" > < div class = "line" > < a name = "l00084" > < / a > < span class = "lineno" > 84< / span >   {< / div >
< div class = "line" > < a name = "l00085" > < / a > < span class = "lineno" > 85< / span >   < span class = "keyword" > static< / span > < span class = "keywordtype" > long< / span > < span class = "keywordtype" > double< / span > past_delta = INFINITY;< / div >
< div class = "line" > < a name = "l00086" > < / a > < span class = "lineno" > 86< / span >   < span class = "keywordflow" > if< / span > (fabsl(past_delta - delta) < = < a class = "code" href = "../../da/d38/durand__kerner__roots_8c.html#af270a96662132d0385cb6b4637c5a689" > ACCURACY< / a > || delta < < a class = "code" href = "../../da/d38/durand__kerner__roots_8c.html#af270a96662132d0385cb6b4637c5a689" > ACCURACY< / a > )< / div >
< div class = "line" > < a name = "l00087" > < / a > < span class = "lineno" > 87< / span >   < span class = "keywordflow" > return< / span > 1;< / div >
< div class = "line" > < a name = "l00088" > < / a > < span class = "lineno" > 88< / span >   past_delta = delta;< / div >
< div class = "line" > < a name = "l00089" > < / a > < span class = "lineno" > 89< / span >   < span class = "keywordflow" > return< / span > 0;< / div >
< div class = "line" > < a name = "l00090" > < / a > < span class = "lineno" > 90< / span >   }< / div >
2020-06-28 23:07:29 +08:00
< / div > <!-- fragment -->
< / div >
< / div >
< a id = "afa5b04ce11475d67049cba8273741fb7" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#afa5b04ce11475d67049cba8273741fb7" > ◆ < / a > < / span > complex_str()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > const char* complex_str < / td >
< td > (< / td >
< td class = "paramtype" > long double complex  < / td >
< td class = "paramname" > < em > x< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
2020-06-29 04:40:24 +08:00
< p > create a textual form of complex number < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
2020-06-28 23:07:29 +08:00
< table class = "params" >
< tr > < td class = "paramdir" > [in]< / td > < td class = "paramname" > x< / td > < td > point at which to evaluate the polynomial < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > pointer to converted string < / dd > < / dl >
2020-06-28 23:30:37 +08:00
< div class = "fragment" > < div class = "line" > < a name = "l00067" > < / a > < span class = "lineno" > 67< / span >   {< / div >
< div class = "line" > < a name = "l00068" > < / a > < span class = "lineno" > 68< / span >   < span class = "keyword" > static< / span > < span class = "keywordtype" > char< / span > msg[50];< / div >
< div class = "line" > < a name = "l00069" > < / a > < span class = "lineno" > 69< / span >   < span class = "keywordtype" > double< / span > r = creal(x);< / div >
< div class = "line" > < a name = "l00070" > < / a > < span class = "lineno" > 70< / span >   < span class = "keywordtype" > double< / span > c = cimag(x);< / div >
< div class = "line" > < a name = "l00071" > < / a > < span class = "lineno" > 71< / span >   < / div >
< div class = "line" > < a name = "l00072" > < / a > < span class = "lineno" > 72< / span >   sprintf(msg, < span class = "stringliteral" > " % 7.04g%+7.04gj" < / span > , r, c);< / div >
< div class = "line" > < a name = "l00073" > < / a > < span class = "lineno" > 73< / span >   < / div >
< div class = "line" > < a name = "l00074" > < / a > < span class = "lineno" > 74< / span >   < span class = "keywordflow" > return< / span > msg;< / div >
< div class = "line" > < a name = "l00075" > < / a > < span class = "lineno" > 75< / span >   }< / div >
2020-06-28 23:07:29 +08:00
< / div > <!-- fragment -->
< / div >
< / div >
< a id = "a3c04138a5bfe5d72780bb7e82a18e627" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a3c04138a5bfe5d72780bb7e82a18e627" > ◆ < / a > < / span > main()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int main < / td >
< td > (< / td >
< td class = "paramtype" > int  < / td >
< td class = "paramname" > < em > argc< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > char **  < / td >
< td class = "paramname" > < em > argv< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > store intermediate values to a CSV file< / p >
2020-06-28 23:30:37 +08:00
< div class = "fragment" > < div class = "line" > < a name = "l00096" > < / a > < span class = "lineno" > 96< / span >   {< / div >
< div class = "line" > < a name = "l00097" > < / a > < span class = "lineno" > 97< / span >   < span class = "keywordtype" > double< / span > *coeffs = NULL;< / div >
< div class = "line" > < a name = "l00098" > < / a > < span class = "lineno" > 98< / span >   < span class = "keywordtype" > long< / span > < span class = "keywordtype" > double< / span > complex *s0 = NULL;< / div >
< div class = "line" > < a name = "l00099" > < / a > < span class = "lineno" > 99< / span >   < span class = "keywordtype" > unsigned< / span > < span class = "keywordtype" > int< / span > degree = 0;< / div >
< div class = "line" > < a name = "l00100" > < / a > < span class = "lineno" > 100< / span >   < span class = "keywordtype" > unsigned< / span > < span class = "keywordtype" > int< / span > n, i;< / div >
< div class = "line" > < a name = "l00101" > < / a > < span class = "lineno" > 101< / span >   < / div >
< div class = "line" > < a name = "l00102" > < / a > < span class = "lineno" > 102< / span >   < span class = "keywordflow" > if< / span > (argc < 2)< / div >
< div class = "line" > < a name = "l00103" > < / a > < span class = "lineno" > 103< / span >   {< / div >
< div class = "line" > < a name = "l00104" > < / a > < span class = "lineno" > 104< / span >   printf(< / div >
< div class = "line" > < a name = "l00105" > < / a > < span class = "lineno" > 105< / span >   < span class = "stringliteral" > " Please pass the coefficients of the polynomial as commandline " < / span > < / div >
< div class = "line" > < a name = "l00106" > < / a > < span class = "lineno" > 106< / span >   < span class = "stringliteral" > " arguments.\n" < / span > );< / div >
2020-06-28 23:07:29 +08:00
< div class = "line" > < a name = "l00107" > < / a > < span class = "lineno" > 107< / span >   < span class = "keywordflow" > return< / span > 0;< / div >
< div class = "line" > < a name = "l00108" > < / a > < span class = "lineno" > 108< / span >   }< / div >
< div class = "line" > < a name = "l00109" > < / a > < span class = "lineno" > 109< / span >   < / div >
< div class = "line" > < a name = "l00110" > < / a > < span class = "lineno" > 110< / span >   degree = argc - 1; < span class = "comment" > /* detected polynomial degree */< / span > < / div >
< div class = "line" > < a name = "l00111" > < / a > < span class = "lineno" > 111< / span >   coeffs = (< span class = "keywordtype" > double< / span > *)malloc(< / div >
< div class = "line" > < a name = "l00112" > < / a > < span class = "lineno" > 112< / span >   degree * < span class = "keyword" > sizeof< / span > (< span class = "keywordtype" > double< / span > )); < span class = "comment" > /* store all input coefficients */< / span > < / div >
< div class = "line" > < a name = "l00113" > < / a > < span class = "lineno" > 113< / span >   s0 = (< span class = "keywordtype" > long< / span > < span class = "keywordtype" > double< / span > complex *)malloc(< / div >
< div class = "line" > < a name = "l00114" > < / a > < span class = "lineno" > 114< / span >   (degree - 1) *< / div >
< div class = "line" > < a name = "l00115" > < / a > < span class = "lineno" > 115< / span >   < span class = "keyword" > sizeof< / span > (< span class = "keywordtype" > long< / span > < span class = "keywordtype" > double< / span > complex)); < span class = "comment" > /* number of roots = degree-1 */< / span > < / div >
< div class = "line" > < a name = "l00116" > < / a > < span class = "lineno" > 116< / span >   < / div >
< div class = "line" > < a name = "l00117" > < / a > < span class = "lineno" > 117< / span >   < span class = "comment" > /* initialize random seed: */< / span > < / div >
< div class = "line" > < a name = "l00118" > < / a > < span class = "lineno" > 118< / span >   srand(time(NULL));< / div >
< div class = "line" > < a name = "l00119" > < / a > < span class = "lineno" > 119< / span >   < / div >
< div class = "line" > < a name = "l00120" > < / a > < span class = "lineno" > 120< / span >   < span class = "keywordflow" > if< / span > (!coeffs || !s0)< / div >
< div class = "line" > < a name = "l00121" > < / a > < span class = "lineno" > 121< / span >   {< / div >
< div class = "line" > < a name = "l00122" > < / a > < span class = "lineno" > 122< / span >   perror(< span class = "stringliteral" > " Unable to allocate memory!" < / span > );< / div >
< div class = "line" > < a name = "l00123" > < / a > < span class = "lineno" > 123< / span >   < span class = "keywordflow" > if< / span > (coeffs)< / div >
< div class = "line" > < a name = "l00124" > < / a > < span class = "lineno" > 124< / span >   free(coeffs);< / div >
< div class = "line" > < a name = "l00125" > < / a > < span class = "lineno" > 125< / span >   < span class = "keywordflow" > if< / span > (s0)< / div >
< div class = "line" > < a name = "l00126" > < / a > < span class = "lineno" > 126< / span >   free(s0);< / div >
< div class = "line" > < a name = "l00127" > < / a > < span class = "lineno" > 127< / span >   < span class = "keywordflow" > return< / span > EXIT_FAILURE;< / div >
< div class = "line" > < a name = "l00128" > < / a > < span class = "lineno" > 128< / span >   }< / div >
< div class = "line" > < a name = "l00129" > < / a > < span class = "lineno" > 129< / span >   < / div >
< div class = "line" > < a name = "l00130" > < / a > < span class = "lineno" > 130< / span >   < span class = "preprocessor" > #if defined(DEBUG) || !defined(NDEBUG)< / span > < / div >
< div class = "line" > < a name = "l00131" > < / a > < span class = "lineno" > 131< / span >   < span class = "comment" > /**< / span > < / div >
< div class = "line" > < a name = "l00132" > < / a > < span class = "lineno" > 132< / span >   < span class = "comment" > * store intermediate values to a CSV file< / span > < / div >
2020-06-29 04:40:24 +08:00
< div class = "line" > < a name = "l00133" > < / a > < span class = "lineno" > 133< / span >   < span class = "comment" > */< / span > < / div >
2020-06-28 23:07:29 +08:00
< div class = "line" > < a name = "l00134" > < / a > < span class = "lineno" > 134< / span >   FILE *log_file = fopen(< span class = "stringliteral" > " durand_kerner.log.csv" < / span > , < span class = "stringliteral" > " wt" < / span > );< / div >
< div class = "line" > < a name = "l00135" > < / a > < span class = "lineno" > 135< / span >   < span class = "keywordflow" > if< / span > (!log_file)< / div >
< div class = "line" > < a name = "l00136" > < / a > < span class = "lineno" > 136< / span >   {< / div >
< div class = "line" > < a name = "l00137" > < / a > < span class = "lineno" > 137< / span >   perror(< span class = "stringliteral" > " Unable to create a storage log file!" < / span > );< / div >
< div class = "line" > < a name = "l00138" > < / a > < span class = "lineno" > 138< / span >   free(coeffs);< / div >
< div class = "line" > < a name = "l00139" > < / a > < span class = "lineno" > 139< / span >   free(s0);< / div >
< div class = "line" > < a name = "l00140" > < / a > < span class = "lineno" > 140< / span >   < span class = "keywordflow" > return< / span > EXIT_FAILURE;< / div >
< div class = "line" > < a name = "l00141" > < / a > < span class = "lineno" > 141< / span >   }< / div >
< div class = "line" > < a name = "l00142" > < / a > < span class = "lineno" > 142< / span >   fprintf(log_file, < span class = "stringliteral" > " iter#," < / span > );< / div >
< div class = "line" > < a name = "l00143" > < / a > < span class = "lineno" > 143< / span >   < span class = "preprocessor" > #endif< / span > < / div >
< div class = "line" > < a name = "l00144" > < / a > < span class = "lineno" > 144< / span >   < / div >
< div class = "line" > < a name = "l00145" > < / a > < span class = "lineno" > 145< / span >   printf(< span class = "stringliteral" > " Computing the roots for:\n\t" < / span > );< / div >
< div class = "line" > < a name = "l00146" > < / a > < span class = "lineno" > 146< / span >   < span class = "keywordflow" > for< / span > (n = 0; n < degree; n++)< / div >
< div class = "line" > < a name = "l00147" > < / a > < span class = "lineno" > 147< / span >   {< / div >
< div class = "line" > < a name = "l00148" > < / a > < span class = "lineno" > 148< / span >   coeffs[n] = strtod(argv[n + 1], NULL);< / div >
< div class = "line" > < a name = "l00149" > < / a > < span class = "lineno" > 149< / span >   < span class = "keywordflow" > if< / span > (n < degree - 1 & & coeffs[n] != 0)< / div >
< div class = "line" > < a name = "l00150" > < / a > < span class = "lineno" > 150< / span >   printf(< span class = "stringliteral" > " (%g) x^%d + " < / span > , coeffs[n], degree - n - 1);< / div >
< div class = "line" > < a name = "l00151" > < / a > < span class = "lineno" > 151< / span >   < span class = "keywordflow" > else< / span > < span class = "keywordflow" > if< / span > (coeffs[n] != 0)< / div >
< div class = "line" > < a name = "l00152" > < / a > < span class = "lineno" > 152< / span >   printf(< span class = "stringliteral" > " (%g) x^%d = 0\n" < / span > , coeffs[n], degree - n - 1);< / div >
< div class = "line" > < a name = "l00153" > < / a > < span class = "lineno" > 153< / span >   < / div >
< div class = "line" > < a name = "l00154" > < / a > < span class = "lineno" > 154< / span >   < span class = "keywordtype" > double< / span > tmp;< / div >
< div class = "line" > < a name = "l00155" > < / a > < span class = "lineno" > 155< / span >   < span class = "keywordflow" > if< / span > (n > 0)< / div >
< div class = "line" > < a name = "l00156" > < / a > < span class = "lineno" > 156< / span >   coeffs[n] /= tmp; < span class = "comment" > /* numerical errors less when the first< / span > < / div >
< div class = "line" > < a name = "l00157" > < / a > < span class = "lineno" > 157< / span >   < span class = "comment" > coefficient is " 1" */< / span > < / div >
< div class = "line" > < a name = "l00158" > < / a > < span class = "lineno" > 158< / span >   < span class = "keywordflow" > else< / span > < / div >
< div class = "line" > < a name = "l00159" > < / a > < span class = "lineno" > 159< / span >   {< / div >
< div class = "line" > < a name = "l00160" > < / a > < span class = "lineno" > 160< / span >   tmp = coeffs[0];< / div >
< div class = "line" > < a name = "l00161" > < / a > < span class = "lineno" > 161< / span >   coeffs[0] = 1;< / div >
< div class = "line" > < a name = "l00162" > < / a > < span class = "lineno" > 162< / span >   }< / div >
< div class = "line" > < a name = "l00163" > < / a > < span class = "lineno" > 163< / span >   < / div >
< div class = "line" > < a name = "l00164" > < / a > < span class = "lineno" > 164< / span >   < span class = "comment" > /* initialize root approximations with random values */< / span > < / div >
< div class = "line" > < a name = "l00165" > < / a > < span class = "lineno" > 165< / span >   < span class = "keywordflow" > if< / span > (n < degree - 1)< / div >
< div class = "line" > < a name = "l00166" > < / a > < span class = "lineno" > 166< / span >   {< / div >
< div class = "line" > < a name = "l00167" > < / a > < span class = "lineno" > 167< / span >   s0[n] = (< span class = "keywordtype" > long< / span > double)rand() + (< span class = "keywordtype" > long< / span > double)rand() * I;< / div >
< div class = "line" > < a name = "l00168" > < / a > < span class = "lineno" > 168< / span >   < span class = "preprocessor" > #if defined(DEBUG) || !defined(NDEBUG)< / span > < / div >
< div class = "line" > < a name = "l00169" > < / a > < span class = "lineno" > 169< / span >   fprintf(log_file, < span class = "stringliteral" > " root_%d," < / span > , n);< / div >
< div class = "line" > < a name = "l00170" > < / a > < span class = "lineno" > 170< / span >   < span class = "preprocessor" > #endif< / span > < / div >
< div class = "line" > < a name = "l00171" > < / a > < span class = "lineno" > 171< / span >   }< / div >
< div class = "line" > < a name = "l00172" > < / a > < span class = "lineno" > 172< / span >   }< / div >
< div class = "line" > < a name = "l00173" > < / a > < span class = "lineno" > 173< / span >   < / div >
< div class = "line" > < a name = "l00174" > < / a > < span class = "lineno" > 174< / span >   < span class = "preprocessor" > #if defined(DEBUG) || !defined(NDEBUG)< / span > < / div >
< div class = "line" > < a name = "l00175" > < / a > < span class = "lineno" > 175< / span >   fprintf(log_file, < span class = "stringliteral" > " avg. correction" < / span > );< / div >
< div class = "line" > < a name = "l00176" > < / a > < span class = "lineno" > 176< / span >   fprintf(log_file, < span class = "stringliteral" > " \n0," < / span > );< / div >
< div class = "line" > < a name = "l00177" > < / a > < span class = "lineno" > 177< / span >   < span class = "keywordflow" > for< / span > (n = 0; n < degree - 1; n++)< / div >
< div class = "line" > < a name = "l00178" > < / a > < span class = "lineno" > 178< / span >   fprintf(log_file, < span class = "stringliteral" > " %s," < / span > , < a class = "code" href = "../../da/d38/durand__kerner__roots_8c.html#afa5b04ce11475d67049cba8273741fb7" > complex_str< / a > (s0[n]));< / div >
< div class = "line" > < a name = "l00179" > < / a > < span class = "lineno" > 179< / span >   < span class = "preprocessor" > #endif< / span > < / div >
< div class = "line" > < a name = "l00180" > < / a > < span class = "lineno" > 180< / span >   < / div >
< div class = "line" > < a name = "l00181" > < / a > < span class = "lineno" > 181< / span >   < span class = "keywordtype" > double< / span > tol_condition = 1;< / div >
< div class = "line" > < a name = "l00182" > < / a > < span class = "lineno" > 182< / span >   < span class = "keywordtype" > unsigned< / span > < span class = "keywordtype" > long< / span > iter = 0;< / div >
< div class = "line" > < a name = "l00183" > < / a > < span class = "lineno" > 183< / span >   < / div >
< div class = "line" > < a name = "l00184" > < / a > < span class = "lineno" > 184< / span >   clock_t end_time, start_time = clock();< / div >
< div class = "line" > < a name = "l00185" > < / a > < span class = "lineno" > 185< / span >   < span class = "keywordflow" > while< / span > (!< a class = "code" href = "../../da/d38/durand__kerner__roots_8c.html#a26d5695ebed0818a3e7cf4b10aacab52" > check_termination< / a > (tol_condition) & & iter < INT_MAX)< / div >
< div class = "line" > < a name = "l00186" > < / a > < span class = "lineno" > 186< / span >   {< / div >
< div class = "line" > < a name = "l00187" > < / a > < span class = "lineno" > 187< / span >   < span class = "keywordtype" > long< / span > < span class = "keywordtype" > double< / span > complex delta = 0;< / div >
< div class = "line" > < a name = "l00188" > < / a > < span class = "lineno" > 188< / span >   tol_condition = 0;< / div >
< div class = "line" > < a name = "l00189" > < / a > < span class = "lineno" > 189< / span >   iter++;< / div >
< div class = "line" > < a name = "l00190" > < / a > < span class = "lineno" > 190< / span >   < / div >
< div class = "line" > < a name = "l00191" > < / a > < span class = "lineno" > 191< / span >   < span class = "preprocessor" > #if defined(DEBUG) || !defined(NDEBUG)< / span > < / div >
< div class = "line" > < a name = "l00192" > < / a > < span class = "lineno" > 192< / span >   fprintf(log_file, < span class = "stringliteral" > " \n%ld," < / span > , iter);< / div >
< div class = "line" > < a name = "l00193" > < / a > < span class = "lineno" > 193< / span >   < span class = "preprocessor" > #endif< / span > < / div >
< div class = "line" > < a name = "l00194" > < / a > < span class = "lineno" > 194< / span >   < / div >
< div class = "line" > < a name = "l00195" > < / a > < span class = "lineno" > 195< / span >   < span class = "keywordflow" > for< / span > (n = 0; n < degree - 1; n++)< / div >
< div class = "line" > < a name = "l00196" > < / a > < span class = "lineno" > 196< / span >   {< / div >
< div class = "line" > < a name = "l00197" > < / a > < span class = "lineno" > 197< / span >   < span class = "keywordtype" > long< / span > < span class = "keywordtype" > double< / span > complex numerator =< / div >
< div class = "line" > < a name = "l00198" > < / a > < span class = "lineno" > 198< / span >   < a class = "code" href = "../../da/d38/durand__kerner__roots_8c.html#adf4ae062a028c6faf2b96c9c1eb343af" > poly_function< / a > (coeffs, degree, s0[n]);< / div >
< div class = "line" > < a name = "l00199" > < / a > < span class = "lineno" > 199< / span >   < span class = "keywordtype" > long< / span > < span class = "keywordtype" > double< / span > complex denominator = 1.0;< / div >
< div class = "line" > < a name = "l00200" > < / a > < span class = "lineno" > 200< / span >   < span class = "keywordflow" > for< / span > (i = 0; i < degree - 1; i++)< / div >
< div class = "line" > < a name = "l00201" > < / a > < span class = "lineno" > 201< / span >   < span class = "keywordflow" > if< / span > (i != n)< / div >
< div class = "line" > < a name = "l00202" > < / a > < span class = "lineno" > 202< / span >   denominator *= s0[n] - s0[i];< / div >
< div class = "line" > < a name = "l00203" > < / a > < span class = "lineno" > 203< / span >   < / div >
< div class = "line" > < a name = "l00204" > < / a > < span class = "lineno" > 204< / span >   delta = numerator / denominator;< / div >
< div class = "line" > < a name = "l00205" > < / a > < span class = "lineno" > 205< / span >   < / div >
< div class = "line" > < a name = "l00206" > < / a > < span class = "lineno" > 206< / span >   < span class = "keywordflow" > if< / span > (isnan(cabsl(delta)) || isinf(cabsl(delta)))< / div >
< div class = "line" > < a name = "l00207" > < / a > < span class = "lineno" > 207< / span >   {< / div >
< div class = "line" > < a name = "l00208" > < / a > < span class = "lineno" > 208< / span >   printf(< span class = "stringliteral" > " \n\nOverflow/underrun error - got value = %Lg" < / span > ,< / div >
< div class = "line" > < a name = "l00209" > < / a > < span class = "lineno" > 209< / span >   cabsl(delta));< / div >
< div class = "line" > < a name = "l00210" > < / a > < span class = "lineno" > 210< / span >   < span class = "keywordflow" > goto< / span > end;< / div >
< div class = "line" > < a name = "l00211" > < / a > < span class = "lineno" > 211< / span >   }< / div >
< div class = "line" > < a name = "l00212" > < / a > < span class = "lineno" > 212< / span >   < / div >
< div class = "line" > < a name = "l00213" > < / a > < span class = "lineno" > 213< / span >   s0[n] -= delta;< / div >
< div class = "line" > < a name = "l00214" > < / a > < span class = "lineno" > 214< / span >   < / div >
< div class = "line" > < a name = "l00215" > < / a > < span class = "lineno" > 215< / span >   tol_condition = fmaxl(tol_condition, fabsl(cabsl(delta)));< / div >
< div class = "line" > < a name = "l00216" > < / a > < span class = "lineno" > 216< / span >   < / div >
< div class = "line" > < a name = "l00217" > < / a > < span class = "lineno" > 217< / span >   < span class = "preprocessor" > #if defined(DEBUG) || !defined(NDEBUG)< / span > < / div >
< div class = "line" > < a name = "l00218" > < / a > < span class = "lineno" > 218< / span >   fprintf(log_file, < span class = "stringliteral" > " %s," < / span > , < a class = "code" href = "../../da/d38/durand__kerner__roots_8c.html#afa5b04ce11475d67049cba8273741fb7" > complex_str< / a > (s0[n]));< / div >
< div class = "line" > < a name = "l00219" > < / a > < span class = "lineno" > 219< / span >   < span class = "preprocessor" > #endif< / span > < / div >
< div class = "line" > < a name = "l00220" > < / a > < span class = "lineno" > 220< / span >   }< / div >
< div class = "line" > < a name = "l00221" > < / a > < span class = "lineno" > 221< / span >   < span class = "comment" > // tol_condition /= (degree - 1);< / span > < / div >
< div class = "line" > < a name = "l00222" > < / a > < span class = "lineno" > 222< / span >   < / div >
< div class = "line" > < a name = "l00223" > < / a > < span class = "lineno" > 223< / span >   < span class = "preprocessor" > #if defined(DEBUG) || !defined(NDEBUG)< / span > < / div >
< div class = "line" > < a name = "l00224" > < / a > < span class = "lineno" > 224< / span >   < span class = "keywordflow" > if< / span > (iter % 500 == 0)< / div >
< div class = "line" > < a name = "l00225" > < / a > < span class = "lineno" > 225< / span >   {< / div >
< div class = "line" > < a name = "l00226" > < / a > < span class = "lineno" > 226< / span >   printf(< span class = "stringliteral" > " Iter: %lu\t" < / span > , iter);< / div >
2020-06-28 23:30:37 +08:00
< div class = "line" > < a name = "l00227" > < / a > < span class = "lineno" > 227< / span >   < span class = "keywordflow" > for< / span > (n = 0; n < degree - 1; n++) printf(< span class = "stringliteral" > " \t%s" < / span > , < a class = "code" href = "../../da/d38/durand__kerner__roots_8c.html#afa5b04ce11475d67049cba8273741fb7" > complex_str< / a > (s0[n]));< / div >
< div class = "line" > < a name = "l00228" > < / a > < span class = "lineno" > 228< / span >   printf(< span class = "stringliteral" > " \t\tabsolute average change: %.4g\n" < / span > , tol_condition);< / div >
< div class = "line" > < a name = "l00229" > < / a > < span class = "lineno" > 229< / span >   }< / div >
< div class = "line" > < a name = "l00230" > < / a > < span class = "lineno" > 230< / span >   < / div >
< div class = "line" > < a name = "l00231" > < / a > < span class = "lineno" > 231< / span >   fprintf(log_file, < span class = "stringliteral" > " %.4g" < / span > , tol_condition);< / div >
< div class = "line" > < a name = "l00232" > < / a > < span class = "lineno" > 232< / span >   < span class = "preprocessor" > #endif< / span > < / div >
< div class = "line" > < a name = "l00233" > < / a > < span class = "lineno" > 233< / span >   }< / div >
< div class = "line" > < a name = "l00234" > < / a > < span class = "lineno" > 234< / span >   end:< / div >
< div class = "line" > < a name = "l00235" > < / a > < span class = "lineno" > 235< / span >   < / div >
< div class = "line" > < a name = "l00236" > < / a > < span class = "lineno" > 236< / span >   end_time = clock();< / div >
< div class = "line" > < a name = "l00237" > < / a > < span class = "lineno" > 237< / span >   < / div >
< div class = "line" > < a name = "l00238" > < / a > < span class = "lineno" > 238< / span >   < span class = "preprocessor" > #if defined(DEBUG) || !defined(NDEBUG)< / span > < / div >
< div class = "line" > < a name = "l00239" > < / a > < span class = "lineno" > 239< / span >   fclose(log_file);< / div >
< div class = "line" > < a name = "l00240" > < / a > < span class = "lineno" > 240< / span >   < span class = "preprocessor" > #endif< / span > < / div >
< div class = "line" > < a name = "l00241" > < / a > < span class = "lineno" > 241< / span >   < / div >
< div class = "line" > < a name = "l00242" > < / a > < span class = "lineno" > 242< / span >   printf(< span class = "stringliteral" > " \nIterations: %lu\n" < / span > , iter);< / div >
< div class = "line" > < a name = "l00243" > < / a > < span class = "lineno" > 243< / span >   < span class = "keywordflow" > for< / span > (n = 0; n < degree - 1; n++) printf(< span class = "stringliteral" > " \t%s\n" < / span > , < a class = "code" href = "../../da/d38/durand__kerner__roots_8c.html#afa5b04ce11475d67049cba8273741fb7" > complex_str< / a > (s0[n]));< / div >
< div class = "line" > < a name = "l00244" > < / a > < span class = "lineno" > 244< / span >   printf(< span class = "stringliteral" > " absolute average change: %.4g\n" < / span > , tol_condition);< / div >
< div class = "line" > < a name = "l00245" > < / a > < span class = "lineno" > 245< / span >   printf(< span class = "stringliteral" > " Time taken: %.4g sec\n" < / span > ,< / div >
< div class = "line" > < a name = "l00246" > < / a > < span class = "lineno" > 246< / span >   (end_time - start_time) / (< span class = "keywordtype" > double< / span > )CLOCKS_PER_SEC);< / div >
< div class = "line" > < a name = "l00247" > < / a > < span class = "lineno" > 247< / span >   < / div >
< div class = "line" > < a name = "l00248" > < / a > < span class = "lineno" > 248< / span >   free(coeffs);< / div >
< div class = "line" > < a name = "l00249" > < / a > < span class = "lineno" > 249< / span >   free(s0);< / div >
< div class = "line" > < a name = "l00250" > < / a > < span class = "lineno" > 250< / span >   < / div >
< div class = "line" > < a name = "l00251" > < / a > < span class = "lineno" > 251< / span >   < span class = "keywordflow" > return< / span > 0;< / div >
< div class = "line" > < a name = "l00252" > < / a > < span class = "lineno" > 252< / span >   }< / div >
2020-06-28 23:07:29 +08:00
< / div > <!-- fragment --> < div class = "dynheader" >
Here is the call graph for this function:< / div >
< div class = "dyncontent" >
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../da/d38/durand__kerner__roots_8c_a3c04138a5bfe5d72780bb7e82a18e627_cgraph.svg" width = "238" height = "139" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
< / div >
< / div >
< / div >
< / div >
< a id = "adf4ae062a028c6faf2b96c9c1eb343af" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#adf4ae062a028c6faf2b96c9c1eb343af" > ◆ < / a > < / span > poly_function()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > long double complex poly_function < / td >
< td > (< / td >
< td class = "paramtype" > double *  < / td >
< td class = "paramname" > < em > coeffs< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > unsigned int  < / td >
< td class = "paramname" > < em > degree< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > long double complex  < / td >
< td class = "paramname" > < em > x< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
2020-06-29 04:40:24 +08:00
< p > Evaluate the value of a polynomial with given coefficients. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
2020-06-28 23:07:29 +08:00
< table class = "params" >
< tr > < td class = "paramdir" > [in]< / td > < td class = "paramname" > coeffs< / td > < td > coefficients of the polynomial < / td > < / tr >
< tr > < td class = "paramdir" > [in]< / td > < td class = "paramname" > degree< / td > < td > degree of polynomial < / td > < / tr >
< tr > < td class = "paramdir" > [in]< / td > < td class = "paramname" > x< / td > < td > point at which to evaluate the polynomial < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > \(f(x)\) < / dd > < / dl >
< div class = "fragment" > < div class = "line" > < a name = "l00052" > < / a > < span class = "lineno" > 52< / span >   {< / div >
< div class = "line" > < a name = "l00053" > < / a > < span class = "lineno" > 53< / span >   < span class = "keywordtype" > long< / span > < span class = "keywordtype" > double< / span > complex out = 0.;< / div >
< div class = "line" > < a name = "l00054" > < / a > < span class = "lineno" > 54< / span >   < span class = "keywordtype" > unsigned< / span > < span class = "keywordtype" > int< / span > n;< / div >
< div class = "line" > < a name = "l00055" > < / a > < span class = "lineno" > 55< / span >   < / div >
2020-06-28 23:30:37 +08:00
< div class = "line" > < a name = "l00056" > < / a > < span class = "lineno" > 56< / span >   < span class = "keywordflow" > for< / span > (n = 0; n < degree; n++) out += coeffs[n] * cpow(x, degree - n - 1);< / div >
< div class = "line" > < a name = "l00057" > < / a > < span class = "lineno" > 57< / span >   < / div >
< div class = "line" > < a name = "l00058" > < / a > < span class = "lineno" > 58< / span >   < span class = "keywordflow" > return< / span > out;< / div >
< div class = "line" > < a name = "l00059" > < / a > < span class = "lineno" > 59< / span >   }< / div >
2020-06-28 23:07:29 +08:00
< / div > <!-- fragment -->
< / div >
< / div >
< / div > <!-- contents -->
< / div > <!-- doc - content -->
2020-06-29 04:40:24 +08:00
< div class = "ttc" id = "adurand__kerner__roots_8c_html_adf4ae062a028c6faf2b96c9c1eb343af" > < div class = "ttname" > < a href = "../../da/d38/durand__kerner__roots_8c.html#adf4ae062a028c6faf2b96c9c1eb343af" > poly_function< / a > < / div > < div class = "ttdeci" > long double complex poly_function(double *coeffs, unsigned int degree, long double complex x)< / div > < div class = "ttdoc" > Evaluate the value of a polynomial with given coefficients.< / div > < div class = "ttdef" > < b > Definition:< / b > durand_kerner_roots.c:50< / div > < / div >
< div class = "ttc" id = "adurand__kerner__roots_8c_html_afa5b04ce11475d67049cba8273741fb7" > < div class = "ttname" > < a href = "../../da/d38/durand__kerner__roots_8c.html#afa5b04ce11475d67049cba8273741fb7" > complex_str< / a > < / div > < div class = "ttdeci" > const char * complex_str(long double complex x)< / div > < div class = "ttdoc" > create a textual form of complex number< / div > < div class = "ttdef" > < b > Definition:< / b > durand_kerner_roots.c:66< / div > < / div >
< div class = "ttc" id = "adurand__kerner__roots_8c_html_a26d5695ebed0818a3e7cf4b10aacab52" > < div class = "ttname" > < a href = "../../da/d38/durand__kerner__roots_8c.html#a26d5695ebed0818a3e7cf4b10aacab52" > check_termination< / a > < / div > < div class = "ttdeci" > char check_termination(long double delta)< / div > < div class = "ttdoc" > check for termination condition< / div > < div class = "ttdef" > < b > Definition:< / b > durand_kerner_roots.c:83< / div > < / div >
< div class = "ttc" id = "adurand__kerner__roots_8c_html_af270a96662132d0385cb6b4637c5a689" > < div class = "ttname" > < a href = "../../da/d38/durand__kerner__roots_8c.html#af270a96662132d0385cb6b4637c5a689" > ACCURACY< / a > < / div > < div class = "ttdeci" > #define ACCURACY< / div > < div class = "ttdoc" > maximum accuracy limit< / div > < div class = "ttdef" > < b > Definition:< / b > durand_kerner_roots.c:41< / div > < / div >
2020-06-28 23:07:29 +08:00
<!-- start footer part -->
< div id = "nav-path" class = "navpath" > <!-- id is needed for treeview function! -->
< ul >
< li class = "navelem" > < a class = "el" href = "../../dir_9c6faab82c22511b50177aa2e38e2780.html" > numerical_methods< / a > < / li > < li class = "navelem" > < a class = "el" href = "../../da/d38/durand__kerner__roots_8c.html" > durand_kerner_roots.c< / a > < / li >
2020-06-28 23:30:37 +08:00
< li class = "footer" > Generated by
2020-06-28 23:07:29 +08:00
< a href = "http://www.doxygen.org/index.html" >
< img class = "footer" src = "../../doxygen.png" alt = "doxygen" / > < / a > 1.8.18 < / li >
< / ul >
< / div >
< / body >
< / html >