mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-07-26 20:14:24 -04:00
Squashed 'boost/' content from commit b4feb19f2
git-subtree-dir: boost git-subtree-split: b4feb19f287ee92d87a9624b5d36b7cf46aeadeb
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="105mm"
|
||||
height="74mm"
|
||||
viewBox="0 0 372.04724 262.20472"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="bad_root_1.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.979899"
|
||||
inkscape:cx="189.57084"
|
||||
inkscape:cy="92.968327"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-790.15748)">
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 37.88072,989.73273 289.4087,0"
|
||||
id="path4136"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#fd0000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 325.7742,835.17939 c -23.65353,47.46915 -63.60501,87.91961 -89.3985,89.3985 -20.95771,0.44107 -36.61946,-32.09659 -57.07362,-32.32488 -28.76939,1.01337 -93.772144,77.33427 -125.258919,136.87569"
|
||||
id="path4138"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:1,1;stroke-dashoffset:0"
|
||||
d="m 194.45437,989.73273 0,-91.92388"
|
||||
id="path4140"
|
||||
inkscape:connector-curvature="0" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
|
||||
x="190.91882"
|
||||
y="995.28857"
|
||||
id="text4142"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4144"
|
||||
x="190.91882"
|
||||
y="995.28857" /></text>
|
||||
<g
|
||||
id="g4154"
|
||||
transform="translate(39.901026,-14.142136)">
|
||||
<text
|
||||
sodipodi:linespacing="125%"
|
||||
id="text4146"
|
||||
y="1020.5424"
|
||||
x="146.9772"
|
||||
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
xml:space="preserve"><tspan
|
||||
y="1020.5424"
|
||||
x="146.9772"
|
||||
id="tspan4148"
|
||||
sodipodi:role="line">Z</tspan></text>
|
||||
<text
|
||||
sodipodi:linespacing="125%"
|
||||
id="text4150"
|
||||
y="1023.5729"
|
||||
x="158.59395"
|
||||
style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
xml:space="preserve"><tspan
|
||||
y="1023.5729"
|
||||
x="158.59395"
|
||||
id="tspan4152"
|
||||
sodipodi:role="line">0</tspan></text>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="105mm"
|
||||
height="74mm"
|
||||
viewBox="0 0 372.04724 262.20472"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="bad_root_2.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="2.8"
|
||||
inkscape:cx="189.57084"
|
||||
inkscape:cy="127.72068"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-790.15748)">
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 37.88072,919.73273 289.4087,0"
|
||||
id="path4136"
|
||||
inkscape:connector-curvature="0" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
|
||||
x="190.91882"
|
||||
y="995.28857"
|
||||
id="text4142"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4144"
|
||||
x="190.91882"
|
||||
y="995.28857" /></text>
|
||||
<g
|
||||
id="g4154"
|
||||
transform="translate(-42.241831,-85.92785)">
|
||||
<text
|
||||
sodipodi:linespacing="125%"
|
||||
id="text4146"
|
||||
y="1020.5424"
|
||||
x="146.9772"
|
||||
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
xml:space="preserve"><tspan
|
||||
y="1020.5424"
|
||||
x="146.9772"
|
||||
id="tspan4148"
|
||||
sodipodi:role="line">Z</tspan></text>
|
||||
<text
|
||||
sodipodi:linespacing="125%"
|
||||
id="text4150"
|
||||
y="1023.5729"
|
||||
x="158.59395"
|
||||
style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
xml:space="preserve"><tspan
|
||||
y="1023.5729"
|
||||
x="158.59395"
|
||||
id="tspan4152"
|
||||
sodipodi:role="line">0</tspan></text>
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 34.345187,838.71493 131.319833,-0.50508 c 9.57898,-0.17125 20.47891,3.32922 22.72843,9.09137 l 40.91118,136.87568 c 2.87617,7.73936 7.91009,12.83981 15.65736,13.13198 l 83.33759,0"
|
||||
id="path4160"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccc" />
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:1,2;stroke-dashoffset:0"
|
||||
d="m 110.71429,919.50505 0,-80.35714"
|
||||
id="path4162"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="105mm"
|
||||
height="74mm"
|
||||
viewBox="0 0 372.04724 262.20472"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="bad_root_3.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="2.8284271"
|
||||
inkscape:cx="115.67091"
|
||||
inkscape:cy="131.59107"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-790.15748)">
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 40.00204,1002.4642 289.4087,0"
|
||||
id="path4136"
|
||||
inkscape:connector-curvature="0" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
|
||||
x="190.91882"
|
||||
y="995.28857"
|
||||
id="text4142"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4144"
|
||||
x="190.91882"
|
||||
y="995.28857" /></text>
|
||||
<g
|
||||
id="g4154"
|
||||
transform="translate(-92.414143,-2.984939)">
|
||||
<text
|
||||
sodipodi:linespacing="125%"
|
||||
id="text4146"
|
||||
y="1020.5424"
|
||||
x="146.9772"
|
||||
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
xml:space="preserve"><tspan
|
||||
y="1020.5424"
|
||||
x="146.9772"
|
||||
id="tspan4148"
|
||||
sodipodi:role="line">Z</tspan></text>
|
||||
<text
|
||||
sodipodi:linespacing="125%"
|
||||
id="text4150"
|
||||
y="1023.5729"
|
||||
x="158.59395"
|
||||
style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
xml:space="preserve"><tspan
|
||||
y="1023.5729"
|
||||
x="158.59395"
|
||||
id="tspan4152"
|
||||
sodipodi:role="line">0</tspan></text>
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 2;stroke-dashoffset:0;stroke-opacity:1"
|
||||
d="m 57.18085,1001.9541 0.5,-143.35718"
|
||||
id="path4162"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 56.568543,808.76391 c 1.957137,59.91372 3.598193,121.77187 5.480077,175.36248 0.36629,6.61011 3.690128,11.1033 10.783379,11.66726 l 257.033311,12.02085"
|
||||
id="path4164"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="105mm"
|
||||
height="74mm"
|
||||
viewBox="0 0 372.04724 262.20472"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="bad_root_4.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="2.8"
|
||||
inkscape:cx="128.67798"
|
||||
inkscape:cy="127.72068"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-790.15748)">
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 37.88072,919.73273 289.4087,0"
|
||||
id="path4136"
|
||||
inkscape:connector-curvature="0" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
|
||||
x="190.91882"
|
||||
y="995.28857"
|
||||
id="text4142"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4144"
|
||||
x="190.91882"
|
||||
y="995.28857" /></text>
|
||||
<g
|
||||
id="g4154"
|
||||
transform="translate(-10.098974,-85.570707)">
|
||||
<text
|
||||
sodipodi:linespacing="125%"
|
||||
id="text4146"
|
||||
y="1020.5424"
|
||||
x="146.9772"
|
||||
style="font-style:normal;font-weight:normal;font-size:15px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
xml:space="preserve"><tspan
|
||||
y="1020.5424"
|
||||
x="146.9772"
|
||||
id="tspan4148"
|
||||
sodipodi:role="line">Z</tspan></text>
|
||||
<text
|
||||
sodipodi:linespacing="125%"
|
||||
id="text4150"
|
||||
y="1023.5729"
|
||||
x="158.59395"
|
||||
style="font-style:normal;font-weight:normal;font-size:10px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
xml:space="preserve"><tspan
|
||||
y="1023.5729"
|
||||
x="158.59395"
|
||||
id="tspan4152"
|
||||
sodipodi:role="line">0</tspan></text>
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 34.345187,838.71493 48.105547,3.06635 c 142.697206,4.63909 37.343126,144.84488 162.511256,150.88474 l 83.33759,4.64286"
|
||||
id="path4160"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 2;stroke-dashoffset:0;stroke-opacity:1"
|
||||
d="m 144.28572,919.50505 -0.35714,-58.92857"
|
||||
id="path4162"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cc" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,20 @@
|
||||
[/./../../../libs/math/doc/roots/elliptic_table_100_gcc_X64_SSE2.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program [@../../example/root_elliptic_finding.cpp root_elliptic_finding.cpp],
|
||||
GNU C++ version 4.9.2, GNU libstdc++ version 20141030, Win32
|
||||
Compiled in optimise mode., _X64_SSE2]
|
||||
[table:elliptic root with radius 28 and arc length 300) for float, double, long double and cpp_bin_float_50 types, using _X64_SSE2
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 5][ 328][1.31][ -1][ ][ 8][ 875][1.51][ 0][ ][ 8][ 1109][1.69][ 4][ ][ 11][479687][1.49][ -3][ ]]
|
||||
[[Newton ][ 3][ 328][1.31][ -1][ ][ 4][ 671][1.16][ 1][ ][ 4][ 781][1.19][ 1][ ][ 5][387500][1.20][ 0][ ]]
|
||||
[[Halley ][ 2][ 250][[role blue 1.00]][ 0][ ][ 3][ 578][[role blue 1.00]][ 1][ ][ 3][ 656][[role blue 1.00]][ 7][ ][ 4][321875][[role blue 1.00]][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 3][ 375][1.50][ -1][ ][ 4][ 734][1.27][ 0][ ][ 4][ 828][1.26][ 3][ ][ 5][414062][1.29][ -2][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,20 @@
|
||||
[/./../../../libs/math/doc/roots/elliptic_table_100_msvc_X64_AVX.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program [@../../example/root_elliptic_finding.cpp root_elliptic_finding.cpp],
|
||||
Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32
|
||||
Compiled in optimise mode., _X64_AVX]
|
||||
[table:elliptic root with radius 28 and arc length 300) for float, double, long double and cpp_bin_float_50 types, using _X64_AVX
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 5][ 500][1.33][ -1][ ][ 9][ 1046][1.72][ 1][ ][ 9][ 1062][1.70][ 1][ ][ 11][698437][1.54][ -3][ ]]
|
||||
[[Newton ][ 3][ 484][1.29][ -1][ ][ 4][ 734][1.21][ 1][ ][ 4][ 687][1.10][ 1][ ][ 5][545312][1.20][ 0][ ]]
|
||||
[[Halley ][ 2][ 375][[role blue 1.00]][ 0][ ][ 3][ 609][[role blue 1.00]][ 3][ ][ 3][ 625][[role blue 1.00]][ 3][ ][ 4][453125][[role blue 1.00]][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 3][ 546][1.46][ -1][ ][ 6][ 1109][1.82][ 1][ ][ 6][ 1187][1.90][ 1][ ][ 5][564062][1.24][ -2][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,20 @@
|
||||
[/..\..\..\../libs/math/doc/roots/elliptic_table_100_msvc_X86_AVX.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program [@../../example/root_elliptic_finding.cpp root_elliptic_finding.cpp],
|
||||
Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32
|
||||
Compiled in optimise mode., _X86_AVX]
|
||||
[table:elliptic root with radius 28 and arc length 300) for float, double, long double and cpp_bin_float_50 types, using _X86_AVX
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 5][ 2187][1.56][ -1][ ][ 9][ 4062][1.86][ 1][ ][ 9][ 4062][1.86][ 1][ ][ 9][11104687][1.30][2027466061][ ]]
|
||||
[[Newton ][ 3][ 2031][1.44][ -1][ ][ 4][ 2812][1.29][ 0][ ][ 4][ 2812][1.29][ 0][ ][ 5][10615625][1.24][2027466058][ ]]
|
||||
[[Halley ][ 2][ 1406][[role blue 1.00]][ 0][ ][ 3][ 2187][[role blue 1.00]][ 1][ ][ 3][ 2187][[role blue 1.00]][ 1][ ][ 4][8567187][[role blue 1.00]][2027466060][ ]]
|
||||
[[Schr'''ö'''der][ 3][ 2187][1.56][ -1][ ][ 4][ 2656][1.21][ 0][ ][ 4][ 2812][1.29][ 0][ ][ 5][10703125][1.25][2027466061][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,20 @@
|
||||
[/./../../../libs/math/doc/roots/elliptic_table_100_msvc_X86_SSE2.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program [@../../example/root_elliptic_finding.cpp root_elliptic_finding.cpp],
|
||||
Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32
|
||||
Compiled in optimise mode., _X86_SSE2]
|
||||
[table:elliptic root with radius 28 and arc length 300) for float, double, long double and cpp_bin_float_50 types, using _X86_SSE2
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 5][ 515][1.43][ -1][ ][ 9][ 968][1.82][ 1][ ][ 9][ 968][1.82][ 1][ ][ 11][871875][1.53][ -3][ ]]
|
||||
[[Newton ][ 3][ 453][1.26][ -1][ ][ 4][ 640][1.21][ 1][ ][ 4][ 640][1.21][ 1][ ][ 5][685937][1.20][ 0][ ]]
|
||||
[[Halley ][ 2][ 359][[role blue 1.00]][ 0][ ][ 3][ 531][[role blue 1.00]][ 3][ ][ 3][ 531][[role blue 1.00]][ 3][ ][ 4][570312][[role blue 1.00]][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 3][ 484][1.35][ -1][ ][ 6][ 1000][1.88][ 1][ ][ 6][ 984][1.85][ 1][ ][ 5][742187][1.30][ -2][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,264 @@
|
||||
[section:brent_minima Locating Function Minima using Brent's algorithm]
|
||||
|
||||
[import ../../example/brent_minimise_example.cpp]
|
||||
|
||||
[h4 Synopsis]
|
||||
|
||||
``
|
||||
#include <boost/math/tools/minima.hpp>
|
||||
|
||||
``
|
||||
|
||||
template <class F, class T>
|
||||
std::pair<T, T> brent_find_minima(F f, T min, T max, int bits);
|
||||
|
||||
template <class F, class T>
|
||||
std::pair<T, T> brent_find_minima(F f, T min, T max, int bits, boost::uintmax_t& max_iter);
|
||||
|
||||
[h4 Description]
|
||||
|
||||
These two functions locate the minima of the continuous function ['f] using
|
||||
[@http://en.wikipedia.org/wiki/Brent%27s_method Brent's method]: specifically it
|
||||
uses quadratic interpolation to locate the minima, or if that fails, falls back to
|
||||
a [@http://en.wikipedia.org/wiki/Golden_section_search golden-section search].
|
||||
|
||||
[*Parameters]
|
||||
|
||||
[variablelist
|
||||
[[f] [The function to minimise: a function object (functor) that should be smooth over the
|
||||
range ['\[min, max\]], with no maxima occurring in that interval.]]
|
||||
[[min] [The lower endpoint of the range in which to search for the minima.]]
|
||||
[[max] [The upper endpoint of the range in which to search for the minima.]]
|
||||
[[bits] [The number of bits precision to which the minima should be found.[br]
|
||||
Note that in principle, the minima can not be located to greater
|
||||
accuracy than the square root of machine epsilon (for 64-bit double, sqrt(1e-16)[cong]1e-8),
|
||||
therefore the value of ['bits] will be ignored if it's greater than half the number of bits
|
||||
in the mantissa of T.]]
|
||||
[[max_iter] [The maximum number of iterations to use
|
||||
in the algorithm, if not provided the algorithm will just
|
||||
keep on going until the minima is found.]]
|
||||
] [/variablelist]
|
||||
|
||||
[*Returns:]
|
||||
|
||||
A `pair` of type T containing the value of the abscissa at the minima and the value
|
||||
of ['f(x)] at the minima.
|
||||
|
||||
[tip Defining BOOST_MATH_INSTRUMENT will show some parameters, for example:
|
||||
``
|
||||
Type T is double
|
||||
bits = 24, maximum 26
|
||||
tolerance = 1.19209289550781e-007
|
||||
seeking minimum in range min-4 to 1.33333333333333
|
||||
maximum iterations 18446744073709551615
|
||||
10 iterations.
|
||||
``
|
||||
]
|
||||
|
||||
[h4:example Brent Minimisation Example]
|
||||
|
||||
As a demonstration, we replicate this [@http://en.wikipedia.org/wiki/Brent%27s_method#Example Wikipedia example]
|
||||
minimising the function ['y= (x+3)(x-1)[super 2]].
|
||||
|
||||
It is obvious from the equation and the plot that there is a
|
||||
minimum at exactly one and the value of the function at one is exactly zero.
|
||||
|
||||
[tip This observation shows that an analytical or
|
||||
[@http://en.wikipedia.org/wiki/Closed-form_expression Closed-form expression]
|
||||
solution always beats brute-force hands-down for both speed and precision.]
|
||||
|
||||
[graph brent_test_function_1]
|
||||
|
||||
First an include is needed:
|
||||
|
||||
[brent_minimise_include_1]
|
||||
|
||||
This function is encoded in C++ as function object (functor) using `double` precision thus:
|
||||
|
||||
[brent_minimise_double_functor]
|
||||
|
||||
The Brent function is conveniently accessed through a `using` statement (noting sub-namespace `::tools`).
|
||||
|
||||
The search minimum and maximum are chosen as -4 to 4/3 (as in the Wikipedia example).
|
||||
|
||||
[tip S A Stage (reference 6) reports that the Brent algorithm is ['slow to start, but fast to converge],
|
||||
so choosing a tight min-max range is good.]
|
||||
|
||||
For simplicity, we set the precision parameter `bits` to `std::numeric_limits<double>::digits`,
|
||||
which is effectively the maximum possible i.e. `std::numeric_limits<double>::digits`/2.
|
||||
Nor do we provide a maximum iterations parameter `max_iter`,
|
||||
(perhaps unwidely), so the function will iterate until it finds a minimum.
|
||||
|
||||
[brent_minimise_double_1]
|
||||
|
||||
The resulting [@http://en.cppreference.com/w/cpp/utility/pair std::pair]
|
||||
contains the minimum close to one and the minimum value close to zero.
|
||||
|
||||
x at minimum = 1.00000000112345, f(1.00000000112345) = 5.04852568272458e-018
|
||||
|
||||
The differences from the expected ['one] and ['zero] are less than the
|
||||
uncertainty (for `double`) 1.5e-008 calculated from
|
||||
`sqrt(std::numeric_limits<double>::digits) == 53`.
|
||||
|
||||
We can use it like this to check that the two values are close-enough to those expected,
|
||||
|
||||
using boost::math::fpc::is_close_to;
|
||||
using boost::math::fpc::is_small;
|
||||
|
||||
double uncertainty = sqrt(std::numeric_limits<double>::digits);
|
||||
is_close_to(1., r.first, uncertainty);
|
||||
is_small(r.second, uncertainty);
|
||||
|
||||
x == 1 (compared to uncertainty 0.00034527) is true
|
||||
f(x) == 0 (compared to uncertainty 0.00034527) is true
|
||||
|
||||
It is possible to make this comparison more generally with a templated function,
|
||||
returning `true` when this criterion is met, for example:
|
||||
|
||||
[brent_minimise_close]
|
||||
|
||||
In practical applications, we might want to know how many iterations,
|
||||
and maybe to limit iterations and
|
||||
perhaps to trade some loss of precision for speed, for example:
|
||||
|
||||
[brent_minimise_double_2]
|
||||
|
||||
limits to a maximum of 20 iterations
|
||||
(a reasonable estimate for this application, even for higher precision shown later).
|
||||
|
||||
The parameter `it` is updated to return the actual number of iterations
|
||||
(so it may be useful to also keep a record of the limit in `maxit`).
|
||||
|
||||
It is neat to avoid showing insignificant digits by computing the number of decimal digits to display.
|
||||
|
||||
[brent_minimise_double_3]
|
||||
|
||||
Showing 53 bits precision with 9 decimal digits from tolerance 1.49011611938477e-008
|
||||
x at minimum = 1, f(1) = 5.04852568e-018
|
||||
|
||||
We can also half the number of precision bits from 52 to 26.
|
||||
|
||||
[brent_minimise_double_4]
|
||||
|
||||
showing no change in the result and no change in the number of iterations, as expected.
|
||||
|
||||
It is only if we reduce the precision to a quarter, specifying only 13 precision bits
|
||||
|
||||
[brent_minimise_double_5]
|
||||
|
||||
that we reduce the number of iterations from 10 to 7 and the result significantly differing from ['one] and ['zero].
|
||||
|
||||
Showing 13 bits precision with 9 decimal digits from tolerance 0.015625
|
||||
x at minimum = 0.9999776, f(0.9999776) = 2.0069572e-009 after 7 iterations.
|
||||
|
||||
[h5:template Templating on floating-point type]
|
||||
|
||||
If we want to switch the floating-point type, then the functor must be revised.
|
||||
Since the functor is stateless, the easiest option is to simply make
|
||||
`operator()` a template member function:
|
||||
|
||||
[brent_minimise_T_functor]
|
||||
|
||||
The `brent_find_minima` function can now be used in template form.
|
||||
|
||||
[brent_minimise_template_1]
|
||||
|
||||
The form shown uses the floating-point type `long double` by deduction,
|
||||
but it is also possible to be more explicit, for example:
|
||||
|
||||
std::pair<long double, long double> r = brent_find_minima<func, long double>
|
||||
(func(), bracket_min, bracket_max, bits, it);
|
||||
|
||||
In order to show the use of multiprecision below, it may be convenient to write a templated function to use this.
|
||||
|
||||
[brent_minimise_T_show]
|
||||
|
||||
We can use this with all built-in floating-point types, for example
|
||||
|
||||
[brent_minimise_template_fd]
|
||||
|
||||
and, on platforms that provide it, a
|
||||
[@http://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format 128-bit quad] type.
|
||||
(See [@boost:libs/multiprecision/doc/html/boost_multiprecision/tut/floats/float128.html float128]).
|
||||
|
||||
For this optional include, the build should define the macro BOOST_HAVE_QUADMATH:
|
||||
|
||||
[brent_minimise_mp_include_1]
|
||||
|
||||
or
|
||||
|
||||
[brent_minimise_template_quad]
|
||||
|
||||
[h5:multiprecision Multiprecision]
|
||||
|
||||
If a higher precision than `double` (or `long double` if that is more precise) is required,
|
||||
then this is easily achieved using __multiprecision with some includes from
|
||||
|
||||
[brent_minimise_mp_include_0]
|
||||
|
||||
and some `typdef`s.
|
||||
|
||||
[brent_minimise_mp_typedefs]
|
||||
Using thus
|
||||
|
||||
[brent_minimise_mp_1]
|
||||
|
||||
and with our show function
|
||||
|
||||
[brent_minimise_mp_2]
|
||||
|
||||
[brent_minimise_mp_output_1]
|
||||
|
||||
[brent_minimise_mp_output_2]
|
||||
|
||||
[tip One can usually rely on template argument deduction
|
||||
to avoid specifying the verbose multiprecision types,
|
||||
but great care in needed with the ['type of the values] provided
|
||||
to avoid confusing the compiler.
|
||||
]
|
||||
|
||||
[tip Using `std::cout.precision(std::numeric_limits<T>::digits10);`
|
||||
or `std::cout.precision(std::numeric_limits<T>::max_digits10);`
|
||||
during debugging may be wise because it gives some warning if construction of multiprecision values
|
||||
involves unintended conversion from `double` by showing trailing zero or random digits after
|
||||
[@http://en.cppreference.com/w/cpp/types/numeric_limits/max_digits10 max_digits10],
|
||||
that is 17 for `double`, digit 18... may be just noise.]
|
||||
|
||||
The complete example code is at [@../../example/brent_minimise_example.cpp brent_minimise_example.cpp].
|
||||
|
||||
[h4 Implementation]
|
||||
|
||||
This is a reasonably faithful implementation of Brent's algorithm.
|
||||
|
||||
[h4 References]
|
||||
|
||||
# Brent, R.P. 1973, Algorithms for Minimization without Derivatives,
|
||||
(Englewood Cliffs, NJ: Prentice-Hall), Chapter 5.
|
||||
|
||||
# Numerical Recipes in C, The Art of Scientific Computing,
|
||||
Second Edition, William H. Press, Saul A. Teukolsky,
|
||||
William T. Vetterling, and Brian P. Flannery.
|
||||
Cambridge University Press. 1988, 1992.
|
||||
|
||||
# An algorithm with guaranteed convergence for finding a zero
|
||||
of a function, R. P. Brent, The Computer Journal, Vol 44, 1971.
|
||||
|
||||
# [@http://en.wikipedia.org/wiki/Brent%27s_method Brent's method in Wikipedia.]
|
||||
|
||||
# Z. Zhang, An Improvement to the Brent's Method, IJEA, vol. 2, pp. 2 to 26, May 31, 2011.
|
||||
[@http://www.cscjournals.org/manuscript/Journals/IJEA/volume2/Issue1/IJEA-7.pdf ]
|
||||
|
||||
# Steven A. Stage, Comments on An Improvement to the Brent's Method
|
||||
(and comparison of various algorithms)
|
||||
[@http://www.cscjournals.org/manuscript/Journals/IJEA/volume4/Issue1/IJEA-33.pdf]
|
||||
Stage concludes that Brent's algorithm is slow to start, but fast to finish convergence, and has good accuracy.
|
||||
|
||||
[endsect] [/section:rebt_minima Locating Function Minima]
|
||||
|
||||
[/
|
||||
Copyright 2006, 2015 John Maddock and Paul A. Bristow.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
@@ -0,0 +1,250 @@
|
||||
[/
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:root_comparison Comparison of Root Finding Algorithms]
|
||||
|
||||
[section:cbrt_comparison Comparison of Cube Root Finding Algorithms]
|
||||
|
||||
In the table below, the cube root of 28 was computed for three __fundamental_types floating-point types,
|
||||
and one __multiprecision type __cpp_bin_float using 50 decimal digit precision, using four algorithms.
|
||||
|
||||
The 'exact' answer was computed using a 100 decimal digit type:
|
||||
|
||||
cpp_bin_float_100 full_answer ("3.036588971875662519420809578505669635581453977248111123242141654169177268411884961770250390838097895");
|
||||
|
||||
Times were measured using __boost_timer using `class cpu_timer`.
|
||||
|
||||
* ['Its] is the number of iterations taken to find the root.
|
||||
* ['Times] is the CPU time-taken in arbitrary units.
|
||||
* ['Norm] is a normalized time, in comparison to the quickest algorithm (with value 1.00).
|
||||
* ['Dis] is the distance from the nearest representation of the 'exact' root in bits.
|
||||
Distance from the 'exact' answer is measured by using function __float_distance.
|
||||
One or two bits distance means that all results are effectively 'correct'.
|
||||
Zero means 'exact' - the nearest __representable value for the floating-point type.
|
||||
|
||||
The cube-root function is a simple function, and is a contrived example for root-finding.
|
||||
It does allow us to investigate some of the factors controlling efficiency that may be extrapolated to
|
||||
more complex functions.
|
||||
|
||||
The program used was [@ ../../example/root_finding_algorithms.cpp root_finding_algorithms.cpp].
|
||||
100000 evaluations of each floating-point type and algorithm were used and the CPU times were
|
||||
judged from repeat runs to have an uncertainty of 10 %. Comparing MSVC for `double` and `long double`
|
||||
(which are identical on this patform) may give a guide to uncertainty of timing.
|
||||
|
||||
The requested precision was set as follows:
|
||||
|
||||
[table
|
||||
[[Function][Precision Requested]]
|
||||
[[TOMS748][numeric_limits<T>::digits - 2]]
|
||||
[[Newton][floor(numeric_limits<T>::digits * 0.6)]]
|
||||
[[Halley][floor(numeric_limits<T>::digits * 0.4)]]
|
||||
[[Schr'''ö'''der][floor(numeric_limits<T>::digits * 0.4)]]
|
||||
]
|
||||
|
||||
* The C++ Standard cube root function [@http://en.cppreference.com/w/cpp/numeric/math/cbrt std::cbrt]
|
||||
is only defined for built-in or fundamental types,
|
||||
so cannot be used with any User-Defined floating-point types like __multiprecision.
|
||||
This, and that the cube function is so impeccably-behaved,
|
||||
allows the implementer to use many tricks to achieve a fast computation.
|
||||
On some platforms,`std::cbrt` appeared several times as quick as the more general `boost::math::cbrt`,
|
||||
on other platforms / compiler options `boost::math::cbrt` is noticeably faster. In general, the results are highly
|
||||
dependent on the code-generation / processor architecture selection compiler options used. One can
|
||||
assume that the standard library will have been compiled with options ['nearly] optimal for the platform
|
||||
it was installed on, where as the user has more choice over the options used for Boost.Math. Pick something
|
||||
too general/conservative and performance suffers, while selecting options that make use of the latest
|
||||
instruction set opcodes speed's things up noticeably.
|
||||
|
||||
* Two compilers in optimise mode were compared: GCC 4.9.1 using Netbeans IDS
|
||||
and Microsoft Visual Studio 2013 (Update 1) on the same hardware.
|
||||
The number of iterations seemed consistent, but the relative run-times surprisingly different.
|
||||
|
||||
* `boost::math::cbrt` allows use with ['any user-defined floating-point type], conveniently
|
||||
__multiprecision. It too can take some advantage of the good-behaviour of the cube function,
|
||||
compared to the more general implementation in the nth root-finding examples. For example,
|
||||
it uses a polynomial approximation to generate a better guess than dividing the exponent by three,
|
||||
and can avoid the complex checks in __newton required to prevent the
|
||||
search going wildly off-track. For a known precision, it may also be possible to
|
||||
fix the number of iterations, allowing inlining and loop unrolling. It also
|
||||
algebraically simplifies the Halley steps leading to a big reduction in the
|
||||
number of floating point operations required compared to a "black box" implementation
|
||||
that calculates the derivatives seperately and then combines them in the Halley code.
|
||||
Typically, it was found that computation using type `double`
|
||||
took a few times longer when using the various root-finding algorithms directly rather
|
||||
than the hand coded/optimized `cbrt` routine.
|
||||
|
||||
* The importance of getting a good guess can be seen by the iteration count for the multiprecision case:
|
||||
here we "cheat" a little and use the cube-root calculated to double precision as the initial guess.
|
||||
The limitation of this tactic is that the range of possible (exponent) values may be less than the multiprecision type.
|
||||
|
||||
* For __fundamental_types, there was little to choose between the three derivative methods,
|
||||
but for __cpp_bin_float, __newton was twice as fast. Note that the cube-root is an extreme
|
||||
test case as the cost of calling the functor is so cheap that the runtimes are largely
|
||||
dominated by the complexity of the iteration code.
|
||||
|
||||
* Compiling with optimisation halved computation times, and any differences between algorithms
|
||||
became nearly negligible. The optimisation speed-up of the __TOMS748 was especially noticable.
|
||||
|
||||
* Using a multiprecision type like `cpp_bin_float_50` for a precision of 50 decimal digits
|
||||
took a lot longer, as expected because most computation
|
||||
uses software rather than 64-bit floating-point hardware.
|
||||
Speeds are often more than 50 times slower.
|
||||
|
||||
* Using `cpp_bin_float_50`, __TOMS748 was much slower showing the benefit of using derivatives.
|
||||
__newton was found to be twice as quick as either of the second-derivative methods:
|
||||
this is an extreme case though, the function and its derivatives are so cheap to compute that we're
|
||||
really measuring the complexity of the boilerplate root-finding code.
|
||||
|
||||
* For multiprecision types only one or two extra ['iterations] are needed to get the remaining 35 digits, whatever the algorithm used.
|
||||
(The time taken was of course much greater for these types).
|
||||
|
||||
* Using a 100 decimal-digit type only doubled the time and required only a very few more iterations,
|
||||
so the cost of extra precision is mainly the underlying cost of computing more digits,
|
||||
not in the way the algorithm works. This confirms previous observations using __NTL high-precision types.
|
||||
|
||||
[include root_comparison_tables_msvc.qbk]
|
||||
[include root_comparison_tables_gcc.qbk]
|
||||
|
||||
[endsect] [/section:cbrt_comparison Comparison of Cube Root Finding Algorithms]
|
||||
|
||||
[section:root_n_comparison Comparison of Nth-root Finding Algorithms]
|
||||
|
||||
A second example compares four generalized nth-root finding algorithms for various n-th roots (5, 7 and 13)
|
||||
of a single value 28.0, for four floating-point types, `float`, `double`,
|
||||
`long double` and a __multiprecision type `cpp_bin_float_50`.
|
||||
In each case the target accuracy was set using our "recomended" accuracy limits
|
||||
(or at least limits that make a good starting point - which is likely to give
|
||||
close to full accuracy without resorting to unnecessary iterations).
|
||||
|
||||
[table
|
||||
[[Function][Precision Requested]]
|
||||
[[TOMS748][numeric_limits<T>::digits - 2]]
|
||||
[[Newton][floor(numeric_limits<T>::digits * 0.6)]]
|
||||
[[Halley][floor(numeric_limits<T>::digits * 0.4)]]
|
||||
[[Schr'''ö'''der][floor(numeric_limits<T>::digits * 0.4)]]
|
||||
]
|
||||
Tests used Microsoft Visual Studio 2013 (Update 1) and GCC 4.9.1 using source code
|
||||
[@../../example/root_n_finding_algorithms.cpp root_n_finding_algorithms.cpp].
|
||||
|
||||
The timing uncertainty (especially using MSVC) is at least 5% of normalized time 'Norm'.
|
||||
|
||||
To pick out the 'best' and 'worst' algorithms are highlighted in blue and red.
|
||||
More than one result can be 'best' when normalized times are indistinguishable
|
||||
within the uncertainty.
|
||||
|
||||
[/include roots_table_100_msvc.qbk]
|
||||
[/include roots_table_75_msvc.qbk]
|
||||
|
||||
[/include roots_table_75_msvc_X86.qbk]
|
||||
[/include roots_table_100_msvc_X86.qbk]
|
||||
|
||||
[/include roots_table_100_msvc_AVX.qbk]
|
||||
[/include roots_table_75_msvc_AVX.qbk]
|
||||
|
||||
[/include roots_table_75_msvc_X86_SSE2.qbk]
|
||||
[/include roots_table_100_msvc_X86_SSE2.qbk]
|
||||
|
||||
[/include roots_table_100_gcc_X64_SSE2.qbk]
|
||||
[/include roots_table_75_gcc_X64_SSE2.qbk]
|
||||
|
||||
[/include type_info_table_100_msvc.qbk]
|
||||
[/include type_info_table_75_msvc.qbk]
|
||||
|
||||
[include roots_table_100_msvc_X86_SSE2.qbk]
|
||||
[include roots_table_100_msvc_X64_AVX.qbk]
|
||||
[include roots_table_100_gcc_X64_SSE2.qbk]
|
||||
|
||||
Some tentative conclusions can be drawn from this limited exercise.
|
||||
|
||||
* Perhaps surprisingly, there is little difference between the various algorithms for __fundamental_types floating-point types.
|
||||
Using the first derivatives (__newton) is usually the best, but while the improvement over the no-derivative
|
||||
__TOMS748 is considerable in number of iterations, but little in execution time. This reflects the fact that the function
|
||||
we are finding the root for is trivial to evaluate, so runtimetimes are dominated by the time taken by the boilerplate code
|
||||
in each method.
|
||||
|
||||
* The extra cost of evaluating the second derivatives (__halley or __schroder) is usually too much for any net benefit:
|
||||
as with the cube root, these functors are so cheap to evaluate that the runtime is largely dominated by the
|
||||
complexity of the root finding method.
|
||||
|
||||
* For a __multiprecision floating-point type, the __newton is a clear winner with a several-fold gain over __TOMS748,
|
||||
and again no improvement from the second-derivative algorithms.
|
||||
|
||||
* The run-time of 50 decimal-digit __multiprecision is about 30-fold greater than `double`.
|
||||
|
||||
* The column 'dis' showing the number of bits distance from the correct result.
|
||||
The Newton-Raphson algorithm shows a bit or two better accuracy than __TOMS748.
|
||||
|
||||
* The goodness of the 'guess' is especially crucial for __multiprecision.
|
||||
Separate experiments show that evaluating the 'guess' using `double` allows
|
||||
convergence to the final exact result in one or two iterations.
|
||||
So in this contrived example, crudely dividing the exponent by N for a 'guess',
|
||||
it would be far better to use a `pow<double>` or ,
|
||||
if more precise `pow<long double>`, function to estimate a 'guess'.
|
||||
The limitation of this tactic is that the range of possible (exponent) values may be less than the multiprecision type.
|
||||
|
||||
* Using floating-point extension __SSE2 made a modest ten-percent speedup.
|
||||
|
||||
*Using MSVC, there was some improvement using 64-bit, markedly for __multiprecision.
|
||||
|
||||
* The GCC compiler 4.9.1 using 64-bit was at least five-folder faster that 32-bit,
|
||||
apparently reflecting better optimization.
|
||||
|
||||
Clearly, your mileage [*will vary], but in summary, __newton seems the first choice of algorithm,
|
||||
and effort to find a good 'guess' the first speed-up target, especially for __multiprecision.
|
||||
And of course, compiler optimisation is crucial for speed.
|
||||
|
||||
[endsect] [/section:root_n_comparison Comparison of Nth-root Finding Algorithms]
|
||||
|
||||
[section:elliptic_comparison Comparison of Elliptic Integral Root Finding Algoritghms]
|
||||
|
||||
A second example compares four root finding algorithms for locating
|
||||
the second radius of an ellipse with first radius 28 and arc length 300,
|
||||
for four floating-point types, `float`, `double`,
|
||||
`long double` and a __multiprecision type `cpp_bin_float_50`.
|
||||
|
||||
Which is to say we're solving:
|
||||
|
||||
[pre 4xE(sqrt(1 - 28[super 2] / x[super 2])) - 300 = 0]
|
||||
|
||||
In each case the target accuracy was set using our "recomended" accuracy limits
|
||||
(or at least limits that make a good starting point - which is likely to give
|
||||
close to full accuracy without resorting to unnecessary iterations).
|
||||
|
||||
[table
|
||||
[[Function][Precision Requested]]
|
||||
[[TOMS748][numeric_limits<T>::digits - 2]]
|
||||
[[Newton][floor(numeric_limits<T>::digits * 0.6)]]
|
||||
[[Halley][floor(numeric_limits<T>::digits * 0.4)]]
|
||||
[[Schr'''ö'''der][floor(numeric_limits<T>::digits * 0.4)]]
|
||||
]
|
||||
Tests used Microsoft Visual Studio 2013 (Update 1) and GCC 4.9.1 using source code
|
||||
[@../../example/root_elliptic_finding.cpp root_elliptic_finding.cpp].
|
||||
|
||||
The timing uncertainty (especially using MSVC) is at least 5% of normalized time 'Norm'.
|
||||
|
||||
To pick out the 'best' and 'worst' algorithms are highlighted in blue and red.
|
||||
More than one result can be 'best' when normalized times are indistinguishable
|
||||
within the uncertainty.
|
||||
|
||||
[include elliptic_table_100_msvc_X86_SSE2.qbk]
|
||||
[include elliptic_table_100_msvc_X64_AVX.qbk]
|
||||
[include elliptic_table_100_gcc_X64_SSE2.qbk]
|
||||
|
||||
Remarks:
|
||||
|
||||
* The function being solved is now moderately expensive to call, and twice as expensive to call
|
||||
when obtaining the derivative than when not. Consequently there is very little improvement in moving
|
||||
from a derivative free method, to Newton iteration. However, once you've calculated the first derivative
|
||||
the second comes almost for free, consequently the third order methods (Halley) does much the best.
|
||||
* Of the two second order methods, Halley does best as would be expected: the Schroder method offers better
|
||||
guarantees of ['quadratic] convergence, while Halley relies on a smooth function with a single root to
|
||||
give ['cubic] convergence. It's not entirely clear why Schroder iteration often does worse than Newton.
|
||||
|
||||
[endsect][/section:elliptic_comparison Comparison of Elliptic Integral Root Finding Algoritghms]
|
||||
|
||||
[endsect] [/section:root_comparison Comparison of Root Finding Algorithms]
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
[/
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h5 Program root_finding_algorithms.cpp, GNU C++ version 4.9.2, GNU libstdc++ version 20141030, Win32, x64[br]1000000 evaluations of each of 5 root_finding algorithms.]
|
||||
[table:cbrt_4 Cube root(28) for float, double, long double and cpp_bin_float_50
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algorithm][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[cbrt ][ 0][46875][[role blue 1.0]][ 0][ ][ 0][46875][[role blue 1.0]][ 0][ ][ 0][46875][[role blue 1.0]][ 0][ ][ 0][3500000][1.1][ 0][ ]]
|
||||
[[TOMS748 ][ 8][187500][4.0][ -1][ ][ 11][406250][[role red 8.7]][ 2][ ][ 10][609375][[role red 13.]][ -1][ ][ 7][44531250][[role red 14.]][ -2][ ]]
|
||||
[[Newton ][ 5][93750][2.0][ 0][ ][ 6][109375][2.3][ 0][ ][ 6][171875][3.7][ 0][ ][ 2][3140625][[role blue 1.0]][ -1][ ]]
|
||||
[[Halley ][ 3][93750][2.0][ 0][ ][ 4][125000][2.7][ 0][ ][ 4][218750][[role red 4.7]][ 0][ ][ 2][7171875][2.3][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 4][109375][2.3][ 0][ ][ 5][171875][3.7][ 0][ ][ 5][281250][[role red 6.0]][ 0][ ][ 2][8703125][2.8][ 0][ ]]
|
||||
] [/end of table cbrt_4]
|
||||
@@ -0,0 +1,27 @@
|
||||
[/
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h5 Program i:/modular-boost/libs/math/example/root_finding_algorithms.cpp, GNU C++ version 4.9.1, GNU libstdc++ version 20140716, Win32, [br]1000000 evaluations of each of 5 root_finding algorithms.[br]Fraction of maximum possible bits of accuracy required is 0.75]
|
||||
[table:cbrt_5 Info for float, double, long double and cpp_bin_float_50
|
||||
[[type name] [max_digits10] [binary digits] [required digits]]
|
||||
[[float][9][24][18]]
|
||||
[[double][17][53][39]]
|
||||
[[long double][21][64][48]]
|
||||
[[cpp_bin_float_50][52][168][126]]
|
||||
] [/table cbrt_5]
|
||||
|
||||
[table:cbrt_4 Cube root(28) for float, double, long double and cpp_bin_float_50
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algorithm][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[cbrt ][ 0][187500][1.0][ 0][ ][ 0][390625][1.0][ 0][ ][ 0][406250][1.0][ 0][ ][ 0][25468750][1.0][ 0][ ]]
|
||||
[[TOMS748 ][ 8][1343750][7.2][ -1][ ][ 11][2140625][5.5][ 2][ ][ 10][4796875][12.][ -1][ ][ 7][300296875][12.][ -2][ ]]
|
||||
[[Newton ][ 6][562500][3.0][ 0][ ][ 7][578125][1.5][ 0][ ][ 7][1703125][4.2][ 0][ ][ 9][71203125][2.8][ -1][ ]]
|
||||
[[Halley ][ 4][765625][4.1][ 0][ ][ 4][703125][1.8][ 0][ ][ 5][1750000][4.3][ -1][ ][ 5][95140625][3.7][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 5][875000][4.7][ 0][ ][ 5][828125][2.1][ 0][ ][ 6][2046875][5.0][ 0][ ][ 7][122906250][4.8][ 0][ ]]
|
||||
] [/end of table cbrt_4]
|
||||
@@ -0,0 +1,19 @@
|
||||
[/
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h5 Program root_finding_algorithms.cpp, Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32, x64[br]1000000 evaluations of each of 5 root_finding algorithms.]
|
||||
[table:cbrt_4 Cube root(28) for float, double, long double and cpp_bin_float_50
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algorithm][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[cbrt ][ 0][46875][[role blue 1.0]][ 0][ ][ 0][46875][[role blue 1.0]][ 1][ ][ 0][46875][[role blue 1.0]][ 1][ ][ 0][4906250][1.1][ 0][ ]]
|
||||
[[TOMS748 ][ 8][234375][[role red 5.0]][ -1][ ][ 11][437500][[role red 9.3]][ 2][ ][ 11][437500][[role red 9.3]][ 2][ ][ 7][66218750][[role red 15.]][ -2][ ]]
|
||||
[[Newton ][ 5][109375][2.3][ 0][ ][ 6][125000][2.7][ 0][ ][ 6][140625][3.0][ 0][ ][ 2][4531250][[role blue 1.0]][ 0][ ]]
|
||||
[[Halley ][ 3][125000][2.7][ 0][ ][ 4][156250][3.3][ 0][ ][ 4][156250][3.3][ 0][ ][ 2][10625000][2.3][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 4][140625][3.0][ 0][ ][ 5][187500][4.0][ 0][ ][ 5][203125][[role red 4.3]][ 0][ ][ 2][13109375][2.9][ 0][ ]]
|
||||
] [/end of table cbrt_4]
|
||||
@@ -0,0 +1,27 @@
|
||||
[/
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h5 Program I:\modular-boost\libs\math\example\root_finding_algorithms.cpp, Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32, Compiled in optimise mode.[br]1000000 evaluations of each of 5 root_finding algorithms.[br]Fraction of maximum possible bits of accuracy required is 0.75]
|
||||
[table:cbrt_5 Info for float, double, long double and cpp_bin_float_50
|
||||
[[type name] [max_digits10] [binary digits] [required digits]]
|
||||
[[float][9][24][18]]
|
||||
[[double][17][53][39]]
|
||||
[[long double][17][53][39]]
|
||||
[[cpp_bin_float_50][52][168][126]]
|
||||
] [/table cbrt_5]
|
||||
|
||||
[table:cbrt_4 Cube root(28) for float, double, long double and cpp_bin_float_50
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algorithm][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[cbrt ][ 0][203125][1.0][ 0][ ][ 0][187500][1.0][ 1][ ][ 0][187500][1.0][ 1][ ][ 0][8796875][1.0][ 0][ ]]
|
||||
[[TOMS748 ][ 8][812500][4.0][ -1][ ][ 11][1031250][5.5][ 2][ ][ 11][1093750][5.8][ 2][ ][ 7][126125000][14.][ -2][ ]]
|
||||
[[Newton ][ 6][968750][4.8][ 0][ ][ 7][968750][5.2][ 0][ ][ 7][1015625][5.4][ 0][ ][ 9][30421875][3.5][ -1][ ]]
|
||||
[[Halley ][ 4][984375][4.8][ 0][ ][ 4][1046875][5.6][ 0][ ][ 4][1078125][5.8][ 0][ ][ 5][47453125][5.4][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 5][968750][4.8][ 0][ ][ 5][1031250][5.5][ 0][ ][ 5][1000000][5.3][ 0][ ][ 7][59140625][6.7][ 0][ ]]
|
||||
] [/end of table cbrt_4]
|
||||
@@ -0,0 +1,595 @@
|
||||
[section:root_finding_examples Examples of Root-Finding (with and without derivatives)]
|
||||
|
||||
[import ../../example/root_finding_example.cpp]
|
||||
[import ../../example/root_finding_n_example.cpp]
|
||||
[import ../../example/root_finding_multiprecision_example.cpp]
|
||||
|
||||
The examples demonstrate how to use the various tools for
|
||||
[@http://en.wikipedia.org/wiki/Root-finding_algorithm root finding].
|
||||
|
||||
We start with the simple cube root function `cbrt` ( C++ standard function name
|
||||
[@http://en.cppreference.com/w/cpp/numeric/math/cbrt cbrt])
|
||||
showing root finding __cbrt_no_derivatives.
|
||||
|
||||
We then show how use of derivatives can improve the speed of convergence.
|
||||
|
||||
(But these examples are only a demonstration and do not try to make
|
||||
the ultimate improvements of an 'industrial-strength'
|
||||
implementation, for example, of `boost::math::cbrt`, mainly by using a better computed initial 'guess'
|
||||
at [@boost:/libs/math/include/boost/math/special_functions/cbrt.hpp cbrt.hpp]).
|
||||
|
||||
Then we show how a higher root (__fifth_root) [super 5][radic] can be computed,
|
||||
and in
|
||||
[@../../example/root_finding_n_example.cpp root_finding_n_example.cpp]
|
||||
a generic method for the __nth_root that constructs the derivatives at compile-time.
|
||||
|
||||
These methods should be applicable to other functions that can be differentiated easily.
|
||||
|
||||
[section:cbrt_eg Finding the Cubed Root With and Without Derivatives]
|
||||
|
||||
First some `#includes` that will be needed.
|
||||
|
||||
[root_finding_include_1]
|
||||
|
||||
[tip For clarity, `using` statements are provided to list what functions are being used in this example:
|
||||
you can, of course, partly or fully qualify the names in other ways.
|
||||
(For your application, you may wish to extract some parts into header files,
|
||||
but you should never use `using` statements globally in header files).]
|
||||
|
||||
Let's suppose we want to find the root of a number ['a], and to start, compute the cube root.
|
||||
|
||||
So the equation we want to solve is:
|
||||
|
||||
__spaces ['f(x) = x[cubed] -a]
|
||||
|
||||
We will first solve this without using any information
|
||||
about the slope or curvature of the cube root function.
|
||||
|
||||
Fortunately, the cube-root function is 'Really Well Behaved' in that it is monotonic
|
||||
and has only one root (we leave negative values 'as an exercise for the student').
|
||||
|
||||
We then show how adding what we can know about this function, first just the slope
|
||||
or 1st derivative ['f'(x)], will speed homing in on the solution.
|
||||
|
||||
Lastly, we show how adding the curvature ['f''(x)] too will speed convergence even more.
|
||||
|
||||
[h3:cbrt_no_derivatives Cube root function without derivatives]
|
||||
|
||||
First we define a function object (functor):
|
||||
|
||||
[root_finding_noderiv_1]
|
||||
|
||||
Implementing the cube-root function itself is fairly trivial now:
|
||||
the hardest part is finding a good approximation to begin with.
|
||||
In this case we'll just divide the exponent by three.
|
||||
(There are better but more complex guess algorithms used in 'real life'.)
|
||||
|
||||
[root_finding_noderiv_2]
|
||||
|
||||
This snippet from `main()` in [@../../example/root_finding_example.cpp root_finding_example.cpp]
|
||||
shows how it can be used.
|
||||
|
||||
[root_finding_main_1]
|
||||
|
||||
[pre
|
||||
cbrt_noderiv(27) = 3
|
||||
cbrt_noderiv(28) = 3.0365889718756618
|
||||
]
|
||||
|
||||
The result of `bracket_and_solve_root` is a [@http://www.cplusplus.com/reference/utility/pair/ pair]
|
||||
of values that could be displayed.
|
||||
|
||||
The number of bits separating them can be found using `float_distance(r.first, r.second)`.
|
||||
The distance is zero (closest representable) for 3[super 3] = 27
|
||||
but `float_distance(r.first, r.second) = 3` for cube root of 28 with this function.
|
||||
The result (avoiding overflow) is midway between these two values.
|
||||
|
||||
[h3:cbrt_1st_derivative Cube root function with 1st derivative (slope)]
|
||||
|
||||
We now solve the same problem, but using more information about the function,
|
||||
to show how this can speed up finding the best estimate of the root.
|
||||
|
||||
For the root function, the 1st differential (the slope of the tangent to a curve at any point) is known.
|
||||
|
||||
This algorithm is similar to this [@http://en.wikipedia.org/wiki/Nth_root_algorithm nth root algorithm].
|
||||
|
||||
If you need some reminders, then
|
||||
[@http://en.wikipedia.org/wiki/Derivative#Derivatives_of_elementary_functions derivatives of elementary functions]
|
||||
may help.
|
||||
|
||||
Using the rule that the derivative of ['x[super n]] for positive n (actually all nonzero n) is ['n x[super n-1]],
|
||||
allows us to get the 1st differential as ['3x[super 2]].
|
||||
|
||||
To see how this extra information is used to find a root, view
|
||||
[@http://en.wikipedia.org/wiki/Newton%27s_method Newton-Raphson iterations]
|
||||
and the [@http://en.wikipedia.org/wiki/Newton%27s_method#mediaviewer/File:NewtonIteration_Ani.gif animation].
|
||||
|
||||
We define a better functor `cbrt_functor_deriv` that returns
|
||||
both the evaluation of the function to solve, along with its first derivative:
|
||||
|
||||
To '['return]' two values, we use a [@http://en.cppreference.com/w/cpp/utility/pair std::pair]
|
||||
of floating-point values.
|
||||
|
||||
[root_finding_1_deriv_1]
|
||||
|
||||
The result of [@boost:/libs/math/include/boost/math/tools/roots.hpp `newton_raphson_iterate`]
|
||||
function is a single value.
|
||||
|
||||
[tip There is a compromise between accuracy and speed when chosing the value of `digits`.
|
||||
It is tempting to simply chose `std::numeric_limits<T>::digits`,
|
||||
but this may mean some inefficient and unnecessary iterations as the function thrashes around
|
||||
trying to locate the last bit. In theory, since the precision doubles with each step
|
||||
it is sufficient to stop when half the bits are correct: as the last step will have doubled
|
||||
that to full precision. Of course the function has no way to tell if that is actually the case
|
||||
unless it does one more step to be sure. In practice setting the precision to slightly more
|
||||
than `std::numeric_limits<T>::digits / 2` is a good choice.]
|
||||
|
||||
Note that it is up to the caller of the function to check the iteration count
|
||||
after the call to see if iteration stoped as a result of running out of iterations
|
||||
rather than meeting the required precision.
|
||||
|
||||
Using the test data in [@../../test/test_cbrt.cpp /test/test_cbrt.cpp] this found the cube root
|
||||
exact to the last digit in every case, and in no more than 6 iterations at double
|
||||
precision. However, you will note that a high precision was used in this
|
||||
example, exactly what was warned against earlier on in these docs! In this
|
||||
particular case it is possible to compute ['f(x)] exactly and without undue
|
||||
cancellation error, so a high limit is not too much of an issue.
|
||||
|
||||
However, reducing the limit to `std::numeric_limits<T>::digits * 2 / 3` gave full
|
||||
precision in all but one of the test cases (and that one was out by just one bit).
|
||||
The maximum number of iterations remained 6, but in most cases was reduced by one.
|
||||
|
||||
Note also that the above code omits a probable optimization by computing z[sup2]
|
||||
and reusing it, omits error handling, and does not handle
|
||||
negative values of z correctly. (These are left as the customary exercise for the reader!)
|
||||
|
||||
The `boost::math::cbrt` function also includes these and other improvements:
|
||||
most importantly it uses a much better initial guess which reduces the iteration count to
|
||||
just 1 in almost all cases.
|
||||
|
||||
[h3:cbrt_2_derivatives Cube root with 1st & 2nd derivative (slope & curvature)]
|
||||
|
||||
Next we define yet another even better functor `cbrt_functor_2deriv` that returns
|
||||
both the evaluation of the function to solve,
|
||||
along with its first [*and second] derivative:
|
||||
|
||||
__spaces['f''(x) = 6x]
|
||||
|
||||
using information about both slope and curvature to speed convergence.
|
||||
|
||||
To [''return'] three values, we use a `tuple` of three floating-point values:
|
||||
[root_finding_2deriv_1]
|
||||
|
||||
The function `halley_iterate` also returns a single value,
|
||||
and the number of iterations will reveal if it met the convergence criterion set by `get_digits`.
|
||||
|
||||
The no-derivative method gives a result of
|
||||
|
||||
cbrt_noderiv(28) = 3.0365889718756618
|
||||
|
||||
with a 3 bits distance between the bracketed values, whereas the derivative methods both converge to a single value
|
||||
|
||||
cbrt_2deriv(28) = 3.0365889718756627
|
||||
|
||||
which we can compare with the [@boost:/libs/math/doc/html/math_toolkit/powers/cbrt.html boost::math::cbrt]
|
||||
|
||||
cbrt(28) = 3.0365889718756627
|
||||
|
||||
Note that the iterations are set to stop at just one-half of full precision,
|
||||
and yet, even so, not one of the test cases had a single bit wrong.
|
||||
What's more, the maximum number of iterations was now just 4.
|
||||
|
||||
Just to complete the picture, we could have called
|
||||
[link math_toolkit.roots.roots_deriv.schroder `schroder_iterate`] in the last
|
||||
example: and in fact it makes no difference to the accuracy or number of iterations
|
||||
in this particular case. However, the relative performance of these two methods
|
||||
may vary depending upon the nature of ['f(x)], and the accuracy to which the initial
|
||||
guess can be computed. There appear to be no generalisations that can be made
|
||||
except "try them and see".
|
||||
|
||||
Finally, had we called `cbrt` with [@http://shoup.net/ntl/doc/RR.txt NTL::RR]
|
||||
set to 1000 bit precision (about 300 decimal digits),
|
||||
then full precision can be obtained with just 7 iterations.
|
||||
To put that in perspective,
|
||||
an increase in precision by a factor of 20, has less than doubled the number of
|
||||
iterations. That just goes to emphasise that most of the iterations are used
|
||||
up getting the first few digits correct: after that these methods can churn out
|
||||
further digits with remarkable efficiency.
|
||||
|
||||
Or to put it another way: ['nothing beats a really good initial guess!]
|
||||
|
||||
Full code of this example is at
|
||||
[@../../example/root_finding_example.cpp root_finding_example.cpp],
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:lambda Using C++11 Lambda's]
|
||||
|
||||
Since all the root finding functions accept a function-object, they can be made to
|
||||
work (often in a lot less code) with C++11 lambda's. Here's the much reduced code for our "toy" cube root function:
|
||||
|
||||
[root_finding_2deriv_lambda]
|
||||
|
||||
Full code of this example is at
|
||||
[@../../example/root_finding_example.cpp root_finding_example.cpp],
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:5th_root_eg Computing the Fifth Root]
|
||||
|
||||
Let's now suppose we want to find the [*fifth root] of a number ['a].
|
||||
|
||||
The equation we want to solve is :
|
||||
|
||||
__spaces['f](x) = ['x[super 5] -a]
|
||||
|
||||
If your differentiation is a little rusty
|
||||
(or you are faced with an function whose complexity makes differentiation daunting),
|
||||
then you can get help, for example, from the invaluable
|
||||
[@http://www.wolframalpha.com/ WolframAlpha site.]
|
||||
|
||||
For example, entering the commmand: `differentiate x ^ 5`
|
||||
|
||||
or the Wolfram Language command: ` D[x ^ 5, x]`
|
||||
|
||||
gives the output: `d/dx(x ^ 5) = 5 x ^ 4`
|
||||
|
||||
and to get the second differential, enter: `second differentiate x ^ 5`
|
||||
|
||||
or the Wolfram Language command: `D[x ^ 5, { x, 2 }]`
|
||||
|
||||
to get the output: `d ^ 2 / dx ^ 2(x ^ 5) = 20 x ^ 3`
|
||||
|
||||
To get a reference value, we can enter: [^fifth root 3126]
|
||||
|
||||
or: `N[3126 ^ (1 / 5), 50]`
|
||||
|
||||
to get a result with a precision of 50 decimal digits:
|
||||
|
||||
5.0003199590478625588206333405631053401128722314376
|
||||
|
||||
(We could also get a reference value using __multiprecision_root).
|
||||
|
||||
The 1st and 2nd derivatives of x[super 5] are:
|
||||
|
||||
__spaces['f]\'(x) = 5x[super 4]
|
||||
|
||||
__spaces['f]\'\'(x) = 20x[super 3]
|
||||
|
||||
[root_finding_fifth_functor_2deriv]
|
||||
[root_finding_fifth_2deriv]
|
||||
|
||||
Full code of this example is at
|
||||
[@../../example/root_finding_example.cpp root_finding_example.cpp] and
|
||||
[@../../example/root_finding_n_example.cpp root_finding_n_example.cpp].
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:multiprecision_root Root-finding using Boost.Multiprecision]
|
||||
|
||||
The apocryphally astute reader might, by now, be asking "How do we know if this computes the 'right' answer?".
|
||||
|
||||
For most values, there is, sadly, no 'right' answer.
|
||||
This is because values can only rarely be ['exactly represented] by C++ floating-point types.
|
||||
What we do want is the 'best' representation - one that is the nearest __representable value.
|
||||
(For more about how numbers are represented see __floating_point).
|
||||
|
||||
Of course, we might start with finding an external reference source like
|
||||
__WolframAlpha, as above, but this is not always possible.
|
||||
|
||||
Another way to reassure is to compute 'reference' values at higher precision
|
||||
with which to compare the results of our iterative computations using built-in like `double`.
|
||||
They should agree within the tolerance that was set.
|
||||
|
||||
The result of `static_cast`ing to `double` from a higher-precision type like `cpp_bin_float_50` is guaranteed
|
||||
to be the [*nearest representable] `double` value.
|
||||
|
||||
For example, the cube root functions in our example for `cbrt(28.)` compute
|
||||
|
||||
`std::cbrt<double>(28.) = 3.0365889718756627`
|
||||
|
||||
WolframAlpha says `3.036588971875662519420809578505669635581453977248111123242141...`
|
||||
|
||||
`static_cast<double>(3.03658897187566251942080957850) = 3.0365889718756627`
|
||||
|
||||
This example `cbrt(28.) = 3.0365889718756627`
|
||||
|
||||
[tip To ensure that all potentially significant decimal digits are displayed use `std::numeric_limits<T>::max_digits10`
|
||||
(or if not available on older platforms or compilers use `2+std::numeric_limits<double>::digits*3010/10000`).[br]
|
||||
|
||||
Ideally, values should agree to `std::numeric-limits<T>::digits10` decimal digits.
|
||||
|
||||
This also means that a 'reference' value to be [*input] or `static_cast` should have
|
||||
at least `max_digits10` decimal digits (17 for 64-bit `double`).
|
||||
]
|
||||
|
||||
If we wish to compute [*higher-precision values] then, on some platforms, we may be able to use `long double`
|
||||
with a higher precision than `double` to compare with the very common `double`
|
||||
and/or a more efficient built-in quad floating-point type like `__float128`.
|
||||
|
||||
Almost all platforms can easily use __multiprecision,
|
||||
for example, __cpp_dec_float or a binary type __cpp_bin_float types,
|
||||
to compute values at very much higher precision.
|
||||
|
||||
[note With multiprecision types, it is debatable whether to use the type `T` for computing the initial guesses.
|
||||
Type `double` is like to be accurate enough for the method used in these examples.
|
||||
This would limit the exponent range of possible values to that of `double`.
|
||||
There is also the cost of conversion to and from type `T` to consider.
|
||||
In these examples, `double` is used via `typedef double guess_type`.]
|
||||
|
||||
Since the functors and functions used above are templated on the value type,
|
||||
we can very simply use them with any of the __multiprecision types. As a reminder,
|
||||
here's our toy cube root function using 2 derivatives and C++11 lambda functions to find the root:
|
||||
|
||||
[root_finding_2deriv_lambda]
|
||||
|
||||
Some examples below are 50 decimal digit decimal and binary types
|
||||
(and on some platforms a much faster `float128` or `quad_float` type )
|
||||
that we can use with these includes:
|
||||
|
||||
[root_finding_multiprecision_include_1]
|
||||
|
||||
Some using statements simplify their use:
|
||||
|
||||
[root_finding_multiprecision_example_1]
|
||||
|
||||
They can be used thus:
|
||||
|
||||
[root_finding_multiprecision_example_2]
|
||||
|
||||
A reference value computed by __WolframAlpha is
|
||||
|
||||
N[2^(1/3), 50] 1.2599210498948731647672106072782283505702514647015
|
||||
|
||||
which agrees exactly.
|
||||
|
||||
To [*show] values to their full precision, it is necessary to adjust the `std::ostream` `precision` to suit the type, for example:
|
||||
|
||||
[root_finding_multiprecision_show_1]
|
||||
|
||||
[root_finding_multiprecision_example_3]
|
||||
|
||||
which outputs:
|
||||
|
||||
[pre
|
||||
cbrt(2) = 1.2599210498948731647672106072782283505702514647015
|
||||
|
||||
value = 2, cube root =1.25992104989487
|
||||
value = 2, cube root =1.25992104989487
|
||||
value = 2, cube root =1.2599210498948731647672106072782283505702514647015
|
||||
]
|
||||
|
||||
[tip Be [*very careful] about the floating-point type `T` that is passed to the root-finding function.
|
||||
Carelessly passing a integer by writing
|
||||
`cpp_dec_float_50 r = cbrt_2deriv(2);` or `show_cube_root(2);`
|
||||
will provoke many warnings and compile errors.
|
||||
|
||||
Even `show_cube_root(2.F);` will produce warnings because `typedef double guess_type` defines the type
|
||||
used to compute the guess and bracket values as `double`.
|
||||
|
||||
Even more treacherous is passing a `double` as in `cpp_dec_float_50 r = cbrt_2deriv(2.);`
|
||||
which silently gives the 'wrong' result, computing a `double` result and [*then] converting to `cpp_dec_float_50`!
|
||||
All digits beyond `max_digits10` will be incorrect.
|
||||
Making the `cbrt` type explicit with `cbrt_2deriv<cpp_dec_float_50>(2.);` will give you the desired 50 decimal digit precision result.
|
||||
] [/tip]
|
||||
|
||||
Full code of this example is at
|
||||
[@../../example/root_finding_multiprecision_example.cpp root_finding_multiprecision_example.cpp].
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:nth_root Generalizing to Compute the nth root]
|
||||
|
||||
If desired, we can now further generalize to compute the ['n]th root by computing the derivatives [*at compile-time]
|
||||
using the rules for differentiation and `boost::math::pow<N>`
|
||||
where template parameter `N` is an integer and a compile time constant. Our functor and function now have an additional template parameter `N`,
|
||||
for the root required.
|
||||
|
||||
[note Since the powers and derivatives are fixed at compile time, the resulting code is as efficient as as if hand-coded as the cube and fifth-root examples above.
|
||||
A good compiler should also optimise any repeated multiplications.]
|
||||
|
||||
Our ['n]th root functor is
|
||||
|
||||
[root_finding_nth_functor_2deriv]
|
||||
|
||||
and our ['n]th root function is
|
||||
|
||||
[root_finding_nth_function_2deriv]
|
||||
|
||||
[root_finding_n_example_2]
|
||||
|
||||
produces an output similar to this
|
||||
|
||||
[root_finding_example_output_1]
|
||||
|
||||
[tip Take care with the type passed to the function. It is best to pass a `double` or greater-precision floating-point type.
|
||||
|
||||
Passing an integer value, for example, `nth_2deriv<5>(2)` will be rejected, while `nth_2deriv<5, double>(2)` converts the integer to `double`.
|
||||
|
||||
Avoid passing a `float` value that will provoke warnings (actually spurious) from the compiler about potential loss of data,
|
||||
as noted above.]
|
||||
|
||||
[warning Asking for unreasonable roots, for example, `show_nth_root<1000000>(2.);` may lead to
|
||||
[@http://en.wikipedia.org/wiki/Loss_of_significance Loss of significance] like
|
||||
`Type double value = 2, 1000000th root = 1.00000069314783`.
|
||||
Use of the the `pow` function is more sensible for this unusual need.
|
||||
]
|
||||
|
||||
Full code of this example is at
|
||||
[@../../example/root_finding_n_example.cpp root_finding_n_example.cpp].
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:elliptic_eg A More complex example - Inverting the Elliptic Integrals]
|
||||
|
||||
The arc length of an ellipse with radii ['a] and ['b] is given by:
|
||||
|
||||
[pre L(a, b) = 4aE(k)]
|
||||
|
||||
with:
|
||||
|
||||
[pre k = [sqrt](1 - b[super 2]/a[super 2])]
|
||||
|
||||
where ['E(k)] is the complete elliptic integral of the second kind - see __ellint_2.
|
||||
|
||||
Let's suppose we know the arc length and one radii, we can then calculate the other
|
||||
radius by inverting the formula above. We'll begin by encoding the above formula
|
||||
into a functor that our root-finding algorithms can call.
|
||||
|
||||
Note that while not
|
||||
completely obvious from the formula above, the function is completely symmetrical
|
||||
in the two radii - which can be interchanged at will - in this case we need to
|
||||
make sure that `a >= b` so that we don't accidentally take the square root of a negative number:
|
||||
|
||||
[import ../../example/root_elliptic_finding.cpp]
|
||||
|
||||
[elliptic_noderv_func]
|
||||
|
||||
We'll also need a decent estimate to start searching from, the approximation:
|
||||
|
||||
[pre L(a, b) [approx] 4[sqrt](a[super 2] + b[super 2])]
|
||||
|
||||
Is easily inverted to give us what we need, which using derivative-free root
|
||||
finding leads to the algorithm:
|
||||
|
||||
[elliptic_root_noderiv]
|
||||
|
||||
This function generally finds the root within 8-10 iterations, so given that the runtime
|
||||
is completely dominated by the cost of calling the ellliptic integral it would be nice to
|
||||
reduce that count somewhat. We'll try to do that by using a derivative-based method;
|
||||
the derivatives of this function are rather hard to work out by hand, but fortunately
|
||||
[@http://www.wolframalpha.com/input/?i=d%2Fda+\[4+*+a+*+EllipticE%281+-+b^2%2Fa^2%29\]
|
||||
Wolfram Alpha] can do the grunt work for us to give:
|
||||
|
||||
[pre d/da L(a, b) = 4(a[super 2]E(k) - b[super 2]K(k)) / (a[super 2] - b[super 2])]
|
||||
|
||||
Note that now we have [*two] elliptic integral calls to get the derivative, so our
|
||||
functor will be at least twice as expensive to call as the derivative-free one above:
|
||||
we'll have to reduce the iteration count quite substantially to make a difference!
|
||||
|
||||
Here's the revised functor:
|
||||
|
||||
[elliptic_1deriv_func]
|
||||
|
||||
The root-finding code is now almost the same as before, but we'll make use of
|
||||
Newton-iteration to get the result:
|
||||
|
||||
[elliptic_1deriv]
|
||||
|
||||
The number of iterations required for `double` precision is now usually around 4 -
|
||||
so we've slightly more than halved the number of iterations, but made the
|
||||
functor twice as expensive to call!
|
||||
|
||||
Interestingly though, the second derivative requires no more expensive
|
||||
elliptic integral calls than the first does, in other words it comes
|
||||
essentially "for free", in which case we might as well make use of it
|
||||
and use Halley-iteration. This is quite a typical situation when
|
||||
inverting special-functions. Here's the revised functor:
|
||||
|
||||
[elliptic_2deriv_func]
|
||||
|
||||
The actual root-finding code is almost the same as before, except we can
|
||||
use Halley, rather than Newton iteration:
|
||||
|
||||
[elliptic_2deriv]
|
||||
|
||||
While this function uses only slightly fewer iterations (typically around 3)
|
||||
to find the root, compared to the original derivative-free method, we've moved from
|
||||
8-10 elliptic integral calls to 6.
|
||||
|
||||
Full code of this example is at
|
||||
[@../../example/root_elliptic_finding.cpp root_elliptic_finding.cpp].
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
[endsect] [/section:root_examples Examples of Root Finding (with and without derivatives)]
|
||||
|
||||
[section:bad_guess The Effect of a Poor Initial Guess]
|
||||
|
||||
It's instructive to take our "toy" example algorithms, and use deliberately bad initial guesses to see how the
|
||||
various root finding algorithms fair. We'll start with the cubed root, and using the cube root of 500 as the test case:
|
||||
|
||||
[table
|
||||
[[Initial Guess=][-500% ([approx]1.323)][-100% ([approx]3.97)][-50% ([approx]3.96)][-20% ([approx]6.35)][-10% ([approx]7.14)][-5% ([approx]7.54)][5% ([approx]8.33)][10% ([approx]8.73)][20% ([approx]9.52)][50% ([approx]11.91)][100% ([approx]15.87)][500 ([approx]47.6)]]
|
||||
[[bracket_and_solve_root][12][8][8][10][11][11][11][11][11][11][7][13]]
|
||||
[[newton_iterate][12][7][7][5][5][4][4][5][5][6][7][9]]
|
||||
[[halley_iterate][7][4][4][3][3][3][3][3][3][4][4][6]]
|
||||
[[schroder_iterate][11][6][6][4][3][3][3][3][4][5][5][8]]
|
||||
]
|
||||
|
||||
As you can see `bracket_and_solve_root` is relatively insensitive to starting location - as long as you don't start many orders of magnitude away from the root it will
|
||||
take roughly the same number of steps to bracket the root and solve it. On the other hand the derivative-based methods are slow to start, but once they have some digits
|
||||
correct they increase precision exceptionally fast: they are therefore quite sensitive to the initial starting location.
|
||||
|
||||
The next table shows the number of iterations required to find the second radius of an ellipse with first radius 50 and arc-length 500:
|
||||
|
||||
[table
|
||||
[[Initial Guess=][-500% ([approx]20.6)][-100% ([approx]61.81)][-50% ([approx]61.81)][-20% ([approx]98.9)][-10% ([approx]111.3)][-5% ([approx]117.4)][5% ([approx]129.8)][10% ([approx]136)][20% ([approx]148.3)][50% ([approx]185.4)][100% ([approx]247.2)][500 ([approx]741.7)]]
|
||||
[[bracket_and_solve_root][11][5][5][8][8][7][7][8][9][8][6][10]]
|
||||
[[newton_iterate][4][4][4][3][3][3][3][3][3][4][4][4]]
|
||||
[[halley_iterate][4][3][3][3][3][2][2][3][3][3][3][3]]
|
||||
[[schroder_iterate][4][3][3][3][3][2][2][3][3][3][3][3]]
|
||||
]
|
||||
|
||||
Interestingly this function is much more resistant to a poor initial guess when using derivatives.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:bad_roots Examples Where Root Finding Goes Wrong]
|
||||
|
||||
There are many reasons why root root finding can fail, here are just a few of the more common examples:
|
||||
|
||||
[h3 Local Minima]
|
||||
|
||||
If you start in the wrong place, such as z[sub 0] here:
|
||||
|
||||
[$../roots/bad_root_1.svg]
|
||||
|
||||
Then almost any root-finding algorithm will descend into a local minima rather than find the root.
|
||||
|
||||
[h3 Flatlining]
|
||||
|
||||
In this example, we're starting from a location (z[sub 0]) where the first derivative is essentially zero:
|
||||
|
||||
[$../roots/bad_root_2.svg]
|
||||
|
||||
In this situation the next iteration will shoot off to infinity (assuming we're using derivatives that is). Our
|
||||
code guards against this by insisting that the root is always bracketed, and then never stepping outside those bounds.
|
||||
In a case like this, no root finding algorithm can do better than bisecting until the root is found.
|
||||
|
||||
Note that there is no scale on the graph, we have seen examples of this situation occur in practice ['even when
|
||||
several decimal places of the initial guess z[sub 0] are correct.]
|
||||
|
||||
This is really a special case of a more common situation where root finding with derivatives is ['divergent]. Consider
|
||||
starting at z[sub 0] in this case:
|
||||
|
||||
[$../roots/bad_root_4.svg]
|
||||
|
||||
An initial Newton step would take you further from the root than you started, as will all subsequent steps.
|
||||
|
||||
[h3 Micro-stepping / Non-convergence]
|
||||
|
||||
Consider starting at z[sub 0] in this situation:
|
||||
|
||||
[$../roots/bad_root_3.svg]
|
||||
|
||||
The first derivative is essentially infinite, and the second close to zero (and so offers no correction if we use it),
|
||||
as a result we take a very small first step. In the worst case situation, the first step is so small
|
||||
- perhaps even so small that subtracting from z[sub 0] has no effect at the current working precision - that our algorithm
|
||||
will assume we are at the root already and terminate. Otherwise we will take lot's of very small steps which never converge
|
||||
on the root: our algorithms will protect against that by reverting to bisection.
|
||||
|
||||
An example of this situation would be trying to find the root of e[super -1/z[super 2]] - this function has a single
|
||||
root at ['z = 0], but for ['z[sub 0] < 0] neither Newton nor Halley steps will ever converge on the root, and for ['z[sub 0] > 0]
|
||||
the steps are actually divergent.
|
||||
|
||||
[endsect]
|
||||
|
||||
[/
|
||||
Copyright 2015 John Maddock and Paul A. Bristow.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
[/
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
Program I:\modular-boost\libs\math\example\root_n_finding_algorithms.cpp,
|
||||
Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32
|
||||
Compiled in optimise mode.
|
||||
|
||||
Fraction of maximum possible bits of accuracy required is 0.75
|
||||
[table:cbrt_5 Info for float, double, long double and cpp_bin_float_50
|
||||
[[type name] [max_digits10] [binary digits] [required digits]]
|
||||
[[float][9][24][18]]
|
||||
[[double][17][53][39]]
|
||||
[[long double][17][53][39]]
|
||||
] [/table cbrt_5]
|
||||
|
||||
[table:cbrt_4 Cube root(28) for float, double, long double and cpp_bin_float_50
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[cbrt ][ 0][ 156][1.00][ 0][ ][ 0][ 156][1.00][ 1][ ][ 0][ 156][1.00][ 1][ ]]
|
||||
[[TOMS748 ][ 8][ 781][5.01][ -1][ ][ 11][ 1093][7.01][ 2][ ][ 11][ 1093][7.01][ 2][ ]]
|
||||
[[Newton ][ 6][ 1093][7.01][ 0][ ][ 7][ 1093][7.01][ 0][ ][ 7][ 937][6.01][ 0][ ]]
|
||||
[[Halley ][ 4][ 1093][7.01][ 0][ ][ 4][ 937][6.01][ 0][ ][ 4][ 937][6.01][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 5][ 1093][7.01][ 0][ ][ 5][ 1093][7.01][ 0][ ][ 5][ 1093][7.01][ 0][ ]]
|
||||
] [/end of table cbrt_4]
|
||||
@@ -0,0 +1,172 @@
|
||||
[section:roots_deriv Root Finding With Derivatives: Newton-Raphson, Halley & Schr'''ö'''der]
|
||||
|
||||
[h4 Synopsis]
|
||||
|
||||
``
|
||||
#include <boost/math/tools/roots.hpp>
|
||||
``
|
||||
|
||||
namespace boost { namespace math {
|
||||
namespace tools { // Note namespace boost::math::tools.
|
||||
// Newton-Raphson
|
||||
template <class F, class T>
|
||||
T newton_raphson_iterate(F f, T guess, T min, T max, int digits);
|
||||
|
||||
template <class F, class T>
|
||||
T newton_raphson_iterate(F f, T guess, T min, T max, int digits, boost::uintmax_t& max_iter);
|
||||
|
||||
// Halley
|
||||
template <class F, class T>
|
||||
T halley_iterate(F f, T guess, T min, T max, int digits);
|
||||
|
||||
template <class F, class T>
|
||||
T halley_iterate(F f, T guess, T min, T max, int digits, boost::uintmax_t& max_iter);
|
||||
|
||||
// Schr'''ö'''der
|
||||
template <class F, class T>
|
||||
T schroder_iterate(F f, T guess, T min, T max, int digits);
|
||||
|
||||
template <class F, class T>
|
||||
T schroder_iterate(F f, T guess, T min, T max, int digits, boost::uintmax_t& max_iter);
|
||||
|
||||
}}} // namespaces boost::math::tools.
|
||||
|
||||
[h4 Description]
|
||||
|
||||
These functions all perform iterative root-finding [*using derivatives]:
|
||||
|
||||
* `newton_raphson_iterate` performs second-order __newton.
|
||||
|
||||
* `halley_iterate` and `schroder_iterate` perform third-order
|
||||
__halley and __schroder iteration.
|
||||
|
||||
The functions all take the same parameters:
|
||||
|
||||
[variablelist Parameters of the root finding functions
|
||||
[[F f] [Type F must be a callable function object that accepts one parameter and
|
||||
returns a __tuple_type:
|
||||
|
||||
For second-order iterative method ([@http://en.wikipedia.org/wiki/Newton_Raphson Newton Raphson])
|
||||
the `tuple` should have [*two] elements containing the evaluation
|
||||
of the function and its first derivative.
|
||||
|
||||
For the third-order methods
|
||||
([@http://en.wikipedia.org/wiki/Halley%27s_method Halley] and
|
||||
Schr'''ö'''der)
|
||||
the `tuple` should have [*three] elements containing the evaluation of
|
||||
the function and its first and second derivatives.]]
|
||||
[[T guess] [The initial starting value. A good guess is crucial to quick convergence!]]
|
||||
[[T min] [The minimum possible value for the result, this is used as an initial lower bracket.]]
|
||||
[[T max] [The maximum possible value for the result, this is used as an initial upper bracket.]]
|
||||
[[int digits] [The desired number of binary digits precision.]]
|
||||
[[uintmax_t& max_iter] [An optional maximum number of iterations to perform. On exit, this is updated to the actual number of iterations performed.]]
|
||||
]
|
||||
|
||||
When using these functions you should note that:
|
||||
|
||||
* Default `max_iter = (std::numeric_limits<boost::uintmax_t>::max)()` is effectively 'iterate for ever'.
|
||||
* They may be very sensitive to the initial guess, typically they converge very rapidly
|
||||
if the initial guess has two or three decimal digits correct. However convergence
|
||||
can be no better than __bisect, or in some rare cases, even worse than __bisect if the
|
||||
initial guess is a long way from the correct value and the derivatives are close to zero.
|
||||
* These functions include special cases to handle zero first (and second where appropriate)
|
||||
derivatives, and fall back to __bisect in this case. However, it is helpful
|
||||
if functor F is defined to return an arbitrarily small value ['of the correct sign] rather
|
||||
than zero.
|
||||
* If the derivative at the current best guess for the result is infinite (or
|
||||
very close to being infinite) then these functions may terminate prematurely.
|
||||
A large first derivative leads to a very small next step, triggering the termination
|
||||
condition. Derivative based iteration may not be appropriate in such cases.
|
||||
* If the function is 'Really Well Behaved' (is monotonic and has only one root)
|
||||
the bracket bounds ['min] and ['max] may as well be set to the widest limits
|
||||
like zero and `numeric_limits<T>::max()`.
|
||||
*But if the function more complex and may have more than one root or a pole,
|
||||
the choice of bounds is protection against jumping out to seek the 'wrong' root.
|
||||
* These functions fall back to __bisect if the next computed step would take the
|
||||
next value out of bounds. The bounds are updated after each step to ensure this leads
|
||||
to convergence. However, a good initial guess backed up by asymptotically-tight
|
||||
bounds will improve performance no end - rather than relying on __bisection.
|
||||
* The value of ['digits] is crucial to good performance of these functions,
|
||||
if it is set too high then at best you will get one extra (unnecessary)
|
||||
iteration, and at worst the last few steps will proceed by __bisection.
|
||||
Remember that the returned value can never be more accurate than ['f(x)] can be
|
||||
evaluated, and that if ['f(x)] suffers from cancellation errors as it
|
||||
tends to zero then the computed steps will be effectively random. The
|
||||
value of ['digits] should be set so that iteration terminates before this point:
|
||||
remember that for second and third order methods the number of correct
|
||||
digits in the result is increasing quite
|
||||
substantially with each iteration, ['digits] should be set by experiment so that the final
|
||||
iteration just takes the next value into the zone where ['f(x)] becomes inaccurate.
|
||||
A good starting point for ['digits] would be 0.6*D for Newton and 0.4*D for Halley or Shr'''ö'''der
|
||||
iteration, where D is `std::numeric_limits<T>::digits`.
|
||||
* If you need some diagnostic output to see what is going on, you can
|
||||
`#define BOOST_MATH_INSTRUMENT` before the `#include <boost/math/tools/roots.hpp>`,
|
||||
and also ensure that display of all the significant digits with
|
||||
` cout.precision(std::numeric_limits<double>::digits10)`:
|
||||
or even possibly significant digits with
|
||||
` cout.precision(std::numeric_limits<double>::max_digits10)`:
|
||||
but be warned, this may produce copious output!
|
||||
* Finally: you may well be able to do better than these functions by hand-coding
|
||||
the heuristics used so that they are tailored to a specific function. You may also
|
||||
be able to compute the ratio of derivatives used by these methods more efficiently
|
||||
than computing the derivatives themselves. As ever, algebraic simplification can
|
||||
be a big win.
|
||||
|
||||
[h4:newton Newton Raphson Method]
|
||||
|
||||
Given an initial guess ['x0] the subsequent values are computed using:
|
||||
|
||||
[equation roots1]
|
||||
|
||||
Out of bounds steps revert to __bisection of the current bounds.
|
||||
|
||||
Under ideal conditions, the number of correct digits doubles with each iteration.
|
||||
|
||||
[h4:halley Halley's Method]
|
||||
|
||||
Given an initial guess ['x0] the subsequent values are computed using:
|
||||
|
||||
[equation roots2]
|
||||
|
||||
Over-compensation by the second derivative (one which would proceed
|
||||
in the wrong direction) causes the method to
|
||||
revert to a Newton-Raphson step.
|
||||
|
||||
Out of bounds steps revert to bisection of the current bounds.
|
||||
|
||||
Under ideal conditions, the number of correct digits trebles with each iteration.
|
||||
|
||||
[h4:schroder Schr'''ö'''der's Method]
|
||||
|
||||
Given an initial guess x0 the subsequent values are computed using:
|
||||
|
||||
[equation roots3]
|
||||
|
||||
Over-compensation by the second derivative (one which would proceed
|
||||
in the wrong direction) causes the method to
|
||||
revert to a Newton-Raphson step. Likewise a Newton step is used
|
||||
whenever that Newton step would change the next value by more than 10%.
|
||||
|
||||
Out of bounds steps revert to __bisection_wikipedia of the current bounds.
|
||||
|
||||
Under ideal conditions, the number of correct digits trebles with each iteration.
|
||||
|
||||
This is Schr'''ö'''der's general result (equation 18 from [@http://drum.lib.umd.edu/handle/1903/577 Stewart, G. W.
|
||||
"On Infinitely Many Algorithms for Solving Equations." English translation of Schr'''ö'''der's original paper.
|
||||
College Park, MD: University of Maryland, Institute for Advanced Computer Studies, Department of Computer Science, 1993].)
|
||||
|
||||
This method guarantees at least quadratic convergence (the same as Newton's method), and is known to work well in the presence of multiple roots:
|
||||
something that neither Newton nor Halley can do.
|
||||
|
||||
[h4 Examples]
|
||||
|
||||
See __root_finding_examples.
|
||||
|
||||
[endsect] [/section:roots_deriv Root Finding With Derivatives]
|
||||
|
||||
[/
|
||||
Copyright 2006, 2010, 2012 John Maddock and Paul A. Bristow.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
Several tools are provided to aid finding minima and roots of functions.
|
||||
|
||||
Some __root_finding_without_derivatives methods are __bisection,
|
||||
__bracket_solve, including use of __root_finding_TOMS748.
|
||||
|
||||
For __root_finding_with_derivatives the methods of
|
||||
__newton, __halley, and __schroder are implemented.
|
||||
|
||||
For locating minima of a function, a __brent_minima_example is provided.
|
||||
|
||||
There are several fully-worked __root_finding_examples, including:
|
||||
|
||||
* __root_finding_example_cbrt_without_derivatives
|
||||
* __root_finding_example_cbrt_with_1_derivative
|
||||
* __root_finding_example_cbrt_with_2_derivatives
|
||||
|
||||
[include roots_without_derivatives.qbk]
|
||||
[include roots.qbk]
|
||||
[include root_finding_examples.qbk]
|
||||
[include minima.qbk]
|
||||
[include root_comparison.qbk]
|
||||
|
||||
[/ roots_overview.qbk
|
||||
Copyright 2015 John Maddock and Paul A. Bristow.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
@@ -0,0 +1,37 @@
|
||||
[/i:/modular-boost/libs/math/doc/roots/roots_table_100_gcc_SEE SEE2 X64 .qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program i:/modular-boost/libs/math/example/root_n_finding_algorithms.cpp,
|
||||
GNU C++ version 4.9.1, GNU libstdc++ version 20140716, Win32
|
||||
Compiled in optimise mode.]
|
||||
Fraction of full accuracy 1
|
||||
[table:root_5 5th root(28) for float, double, long double and cpp_bin_float_50 types.
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 7][ 296][2.72][ 0][ ][ 11][ 500][3.57][ 1][ ][ 9][ 1593][4.25][ 0][ ][ 12][74953][7.01][ 0][ ]]
|
||||
[[Newton ][ 3][ 109][1.00][ 0][ ][ 5][ 140][1.00][ -1][ ][ 4][ 375][1.00][ 0][ ][ 6][10687][1.00][ 0][ ]]
|
||||
[[Halley ][ 2][ 109][1.00][ 0][ ][ 4][ 171][1.22][ 0][ ][ 3][ 453][1.21][ 0][ ][ 4][17578][1.64][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 203][1.86][ 0][ ][ 8][ 250][1.79][ -1][ ][ 7][ 609][1.62][ 0][ ][ 8][33546][3.14][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_7 7th root(28) for float, double, long double and cpp_bin_float_50 types.
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 500][3.21][ 1][ ][ 15][ 687][4.40][ 2][ ][ 13][ 2390][5.11][ 0][ ][ 14][99765][5.95][ 0][ ]]
|
||||
[[Newton ][ 6][ 156][1.00][ 0][ ][ 7][ 156][1.00][ 0][ ][ 6][ 468][1.00][ 0][ ][ 8][16765][1.00][ 0][ ]]
|
||||
[[Halley ][ 5][ 187][1.20][ 0][ ][ 6][ 218][1.40][ 0][ ][ 5][ 796][1.70][ 0][ ][ 6][29250][1.74][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 203][1.30][ 0][ ][ 6][ 234][1.50][ 0][ ][ 6][ 531][1.13][ 0][ ][ 7][30687][1.83][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_11 11th root(28) for float, double, long double and cpp_bin_float_50 types.
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 593][3.47][ -2][ ][ 14][ 734][3.93][ 2][ ][ 14][ 2750][5.18][ 1][ ][ 17][155921][7.06][ 2][ ]]
|
||||
[[Newton ][ 7][ 171][1.00][ 0][ ][ 8][ 187][1.00][ 0][ ][ 8][ 531][1.00][ 0][ ][ 10][22093][1.00][ 0][ ]]
|
||||
[[Halley ][ 5][ 187][1.09][ 0][ ][ 6][ 234][1.25][ 0][ ][ 6][ 703][1.32][ 0][ ][ 7][36375][1.65][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 7][ 234][1.37][ 0][ ][ 7][ 250][1.34][ 0][ ][ 8][ 625][1.18][ 0][ ][ 8][37843][1.71][ 0][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,37 @@
|
||||
[/./../../../libs/math/doc/roots/roots_table_100_gcc_X64_SSE2.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program root_n_finding_algorithms.cpp,
|
||||
GNU C++ version 4.9.2, GNU libstdc++ version 20141030, Win32
|
||||
Compiled in optimise mode., _X64_SSE2]
|
||||
Fraction of full accuracy 1
|
||||
[table:root_5 5th root(28) for float, double, long double and cpp_bin_float_50 types, using _X64_SSE2
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 7][ 193][2.14][ 0][ ][ 11][ 432][3.86][ 1][ ][ 9][ 579][3.83][ 0][ ][ 12][59062][[role red 7.56]][ 0][ ]]
|
||||
[[Newton ][ 3][ 90][[role blue 1.00]][ 0][ ][ 4][ 112][[role blue 1.00]][ -1][ ][ 5][ 151][[role blue 1.00]][ 0][ ][ 6][ 7812][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 2][ 98][1.09][ 0][ ][ 3][ 135][1.21][ 0][ ][ 3][ 201][1.33][ 0][ ][ 4][13750][1.76][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 2][ 112][1.24][ 0][ ][ 3][ 142][1.27][ -1][ ][ 3][ 206][1.36][ 0][ ][ 4][17031][2.18][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_7 7th root(28) for float, double, long double and cpp_bin_float_50 types, using _X64_SSE2
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 351][1.97][ 1][ ][ 15][ 621][3.18][ 2][ ][ 13][ 906][3.61][ 0][ ][ 14][75468][[role red 7.10]][ 0][ ]]
|
||||
[[Newton ][ 5][ 178][[role blue 1.00]][ 0][ ][ 6][ 195][[role blue 1.00]][ 0][ ][ 7][ 251][[role blue 1.00]][ 0][ ][ 8][10625][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 4][ 196][1.10][ 0][ ][ 5][ 242][1.24][ 0][ ][ 5][ 345][1.37][ 0][ ][ 6][21093][1.99][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 5][ 225][1.26][ 0][ ][ 6][ 270][1.38][ 0][ ][ 6][ 384][1.53][ 0][ ][ 7][29062][2.74][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_11 11th root(28) for float, double, long double and cpp_bin_float_50 types, using _X64_SSE2
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 429][2.22][ -2][ ][ 14][ 679][3.02][ 2][ ][ 14][ 1098][3.94][ 1][ ][ 17][114531][[role red 8.83]][ 2][ ]]
|
||||
[[Newton ][ 6][ 193][[role blue 1.00]][ 0][ ][ 7][ 225][[role blue 1.00]][ 0][ ][ 7][ 279][[role blue 1.00]][ 0][ ][ 9][12968][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 4][ 196][[role blue 1.02]][ -1][ ][ 5][ 248][1.10][ 0][ ][ 5][ 348][1.25][ 0][ ][ 6][21718][1.67][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 254][1.32][ 0][ ][ 7][ 323][1.44][ 0][ ][ 7][ 453][1.62][ 0][ ][ 8][35625][2.75][ 0][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,37 @@
|
||||
[/i:/modular-boost/libs/math/doc/roots/roots_table_100_msvc.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program I:\modular-boost\libs\math\example\root_n_finding_algorithms.cpp,
|
||||
Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32
|
||||
Compiled in optimise mode.]
|
||||
Fraction of full accuracy 1
|
||||
[table:root_5 5th root(28) for float, double, long double and cpp_bin_float_50 types
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 7][ 750][[role blue 1.00]][ 0][ ][ 11][ 1015][1.08][ 1][ ][ 11][ 1000][1.03][ 1][ ][ 12][145687][[role red 6.07]][ 0][ ]]
|
||||
[[Newton ][ 3][ 890][1.19][ 0][ ][ 5][ 937][[role blue 1.00]][ -1][ ][ 5][ 968][[role blue 1.00]][ -1][ ][ 6][24000][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 2][ 921][1.23][ 0][ ][ 4][ 953][[role blue 1.02]][ 0][ ][ 4][ 968][[role blue 1.00]][ 0][ ][ 4][41468][1.73][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 984][1.31][ 0][ ][ 8][ 1062][1.13][ -1][ ][ 8][ 1046][1.08][ -1][ ][ 8][72062][3.00][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_7 7th root(28) for float, double, long double and cpp_bin_float_50 types
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 1015][1.07][ 1][ ][ 15][ 1218][1.22][ 2][ ][ 15][ 1218][1.24][ 2][ ][ 14][191937][[role red 5.43]][ 0][ ]]
|
||||
[[Newton ][ 6][ 953][[role blue 1.00]][ 0][ ][ 7][ 1000][[role blue 1.00]][ 0][ ][ 7][ 984][[role blue 1.00]][ 0][ ][ 8][35359][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 5][ 984][1.03][ 0][ ][ 6][ 1031][1.03][ 0][ ][ 6][ 1015][1.03][ 0][ ][ 6][66968][1.89][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 984][1.03][ 0][ ][ 6][ 1000][[role blue 1.00]][ 0][ ][ 6][ 1000][[role blue 1.02]][ 0][ ][ 7][67437][1.91][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_11 11th root(28) for float, double, long double and cpp_bin_float_50 types
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 1078][1.11][ -2][ ][ 14][ 1312][1.33][ 2][ ][ 14][ 1296][1.28][ 2][ ][ 17][294640][[role red 6.24]][ 2][ ]]
|
||||
[[Newton ][ 7][ 968][[role blue 1.00]][ 0][ ][ 8][ 984][[role blue 1.00]][ 0][ ][ 8][ 1015][[role blue 1.00]][ 0][ ][ 10][47187][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 5][ 1000][1.03][ 0][ ][ 6][ 1046][1.06][ 0][ ][ 6][ 1109][1.09][ 0][ ][ 7][79187][1.68][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 7][ 1062][1.10][ 0][ ][ 7][ 1062][1.08][ 0][ ][ 7][ 1062][1.05][ 0][ ][ 8][78406][1.66][ 0][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,37 @@
|
||||
[/i:/modular-boost/libs/math/doc/roots/roots_table_100_msvc_AVX.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program I:\modular-boost\libs\math\example\root_n_finding_algorithms.cpp,
|
||||
Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32
|
||||
Compiled in optimise mode., _AVX]
|
||||
Fraction of full accuracy 1
|
||||
[table:root_5 5th root(28) for float, double, long double and cpp_bin_float_50 types, using _AVX
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 7][ 734][[role green 1.0000]1.00][ 0][ ][ 11][ 1015][1.06511.07][ 1][ ][ 11][ 1031][1.08181.08][ 1][ ][ 12][145968][[role red 5.8941]5.89][ 0][ ]]
|
||||
[[Newton ][ 3][ 906][1.23431.23][ 0][ ][ 5][ 953][[role green 1.0000]1.00][ -1][ ][ 5][ 953][[role green 1.0000]1.00][ -1][ ][ 6][24765][[role green 1.0000]1.00][ 0][ ]]
|
||||
[[Halley ][ 2][ 921][1.25481.25][ 0][ ][ 4][ 1015][1.06511.07][ 0][ ][ 4][ 1000][1.04931.05][ 0][ ][ 4][42156][1.70221.70][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 1000][1.36241.36][ 0][ ][ 8][ 1062][1.11441.11][ -1][ ][ 8][ 1062][1.11441.11][ -1][ ][ 8][72500][2.92752.93][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_7 7th root(28) for float, double, long double and cpp_bin_float_50 types, using _AVX
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 984][1.03251.03][ 1][ ][ 15][ 1234][1.25411.25][ 2][ ][ 15][ 1218][1.23781.24][ 2][ ][ 14][191484][[role red 5.3353]5.34][ 0][ ]]
|
||||
[[Newton ][ 6][ 953][[role green 1.0000]1.00][ 0][ ][ 7][ 984][[role green 1.0000]1.00][ 0][ ][ 7][ 984][[role green 1.0000]1.00][ 0][ ][ 8][35890][[role green 1.0000]1.00][ 0][ ]]
|
||||
[[Halley ][ 5][ 1000][1.04931.05][ 0][ ][ 6][ 1046][1.06301.06][ 0][ ][ 6][ 1046][1.06301.06][ 0][ ][ 6][66859][1.86291.86][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 1015][1.06511.07][ 0][ ][ 6][ 1015][1.03151.03][ 0][ ][ 6][ 1000][[role green 1.0163]1.02][ 0][ ][ 7][68375][1.90511.91][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_11 11th root(28) for float, double, long double and cpp_bin_float_50 types, using _AVX
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 1078][1.09551.10][ -2][ ][ 14][ 1265][1.22701.23][ 2][ ][ 14][ 1265][1.22701.23][ 2][ ][ 17][288593][[role red 6.3844]6.38][ 2][ ]]
|
||||
[[Newton ][ 7][ 984][[role green 1.0000]1.00][ 0][ ][ 8][ 1031][[role green 1.0000]1.00][ 0][ ][ 8][ 1031][[role green 1.0000]1.00][ 0][ ][ 10][45203][[role green 1.0000]1.00][ 0][ ]]
|
||||
[[Halley ][ 5][ 1015][1.03151.03][ 0][ ][ 6][ 1078][1.04561.05][ 0][ ][ 6][ 1062][1.03011.03][ 0][ ][ 7][77625][1.71731.72][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 7][ 1031][1.04781.05][ 0][ ][ 7][ 1046][[role green 1.0145]1.01][ 0][ ][ 7][ 1031][[role green 1.0000]1.00][ 0][ ][ 8][77718][1.71931.72][ 0][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,37 @@
|
||||
[/./../../../libs/math/doc/roots/roots_table_100_msvc_X64_AVX.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program root_n_finding_algorithms.cpp,
|
||||
Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32
|
||||
Compiled in optimise mode., _X64_AVX]
|
||||
Fraction of full accuracy 1
|
||||
[table:root_5 5th root(28) for float, double, long double and cpp_bin_float_50 types, using _X64_AVX
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 7][ 239][1.50][ 0][ ][ 11][ 451][2.53][ 1][ ][ 11][ 439][2.49][ 1][ ][ 12][90312][[role red 7.51]][ 0][ ]]
|
||||
[[Newton ][ 3][ 159][[role blue 1.00]][ 0][ ][ 4][ 178][[role blue 1.00]][ -1][ ][ 4][ 176][[role blue 1.00]][ -1][ ][ 6][12031][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 2][ 168][1.06][ 0][ ][ 3][ 203][1.14][ 0][ ][ 3][ 198][1.13][ 0][ ][ 4][20937][1.74][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 2][ 173][1.09][ 0][ ][ 3][ 206][1.16][ -1][ ][ 3][ 203][1.15][ -1][ ][ 4][26250][2.18][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_7 7th root(28) for float, double, long double and cpp_bin_float_50 types, using _X64_AVX
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 385][2.19][ 1][ ][ 15][ 635][3.13][ 2][ ][ 15][ 621][3.17][ 2][ ][ 14][114843][[role red 6.81]][ 0][ ]]
|
||||
[[Newton ][ 5][ 176][[role blue 1.00]][ 0][ ][ 6][ 203][[role blue 1.00]][ 0][ ][ 6][ 196][[role blue 1.00]][ 0][ ][ 8][16875][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 4][ 209][1.19][ 0][ ][ 5][ 254][1.25][ 0][ ][ 5][ 246][1.26][ 0][ ][ 6][32343][1.92][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 5][ 223][1.27][ 0][ ][ 6][ 273][1.34][ 0][ ][ 6][ 275][1.40][ 0][ ][ 7][45156][2.68][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_11 11th root(28) for float, double, long double and cpp_bin_float_50 types, using _X64_AVX
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 467][2.42][ -2][ ][ 14][ 648][3.06][ 2][ ][ 14][ 640][2.99][ 2][ ][ 17][170000][[role red 8.85]][ 2][ ]]
|
||||
[[Newton ][ 6][ 193][[role blue 1.00]][ 0][ ][ 7][ 212][[role blue 1.00]][ 0][ ][ 7][ 214][[role blue 1.00]][ 0][ ][ 9][19218][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 4][ 209][1.08][ -1][ ][ 5][ 256][1.21][ 0][ ][ 5][ 250][1.17][ 0][ ][ 6][32656][1.70][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 248][1.28][ 0][ ][ 7][ 306][1.44][ 0][ ][ 7][ 298][1.39][ 0][ ][ 8][53437][2.78][ 0][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,37 @@
|
||||
[/i:/modular-boost/libs/math/doc/roots/roots_table_100_msvc_X86.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program I:\modular-boost\libs\math\example\root_n_finding_algorithms.cpp,
|
||||
Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32
|
||||
Compiled in optimise mode., _X86]
|
||||
Fraction of full accuracy 1
|
||||
[table:root_5 5th root(28) for float, double, long double and cpp_bin_float_50 types, using _X86
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 8][ 1109][1.08][ -2][ ][ 11][ 1265][1.29][ 1][ ][ 11][ 1203][1.22][ 1][ ][ 12][145453][[role red 5.95]][ 0][ ]]
|
||||
[[Newton ][ 4][ 1031][[role blue 1.00]][ 0][ ][ 5][ 984][[role blue 1.00]][ -1][ ][ 5][ 984][[role blue 1.00]][ -1][ ][ 6][24453][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 3][ 1046][[role blue 1.01]][ 0][ ][ 4][ 1046][1.06][ 0][ ][ 4][ 1046][1.06][ 0][ ][ 4][40921][1.67][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 7][ 1250][1.21][ 0][ ][ 8][ 1078][1.10][ -1][ ][ 8][ 1078][1.10][ -1][ ][ 8][70750][2.89][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_7 7th root(28) for float, double, long double and cpp_bin_float_50 types, using _X86
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 1562][1.39][ 1][ ][ 15][ 1484][1.51][ 2][ ][ 15][ 1437][1.46][ 2][ ][ 14][188640][[role red 5.29]][ 0][ ]]
|
||||
[[Newton ][ 6][ 1125][[role blue 1.00]][ 0][ ][ 7][ 984][[role blue 1.00]][ 0][ ][ 7][ 984][[role blue 1.00]][ 0][ ][ 8][35640][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 5][ 1156][[role blue 1.03]][ 0][ ][ 6][ 1125][1.14][ 0][ ][ 6][ 1109][1.13][ 0][ ][ 6][65218][1.83][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 1187][1.06][ 0][ ][ 6][ 1031][[role blue 1.05]][ 0][ ][ 6][ 1015][[role blue 1.03]][ 0][ ][ 7][66828][1.88][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_11 11th root(28) for float, double, long double and cpp_bin_float_50 types, using _X86
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 1812][1.49][ -2][ ][ 14][ 1531][1.48][ 2][ ][ 14][ 1500][1.43][ 2][ ][ 17][284937][[role red 6.38]][ 2][ ]]
|
||||
[[Newton ][ 7][ 1218][[role blue 1.00]][ -1][ ][ 8][ 1031][[role blue 1.00]][ 0][ ][ 8][ 1046][[role blue 1.00]][ 0][ ][ 10][44640][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 5][ 1265][[role blue 1.04]][ -1][ ][ 6][ 1156][1.12][ 0][ ][ 6][ 1140][1.09][ 0][ ][ 7][77843][1.74][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 7][ 1343][1.10][ -1][ ][ 7][ 1046][[role blue 1.01]][ 0][ ][ 7][ 1109][1.06][ 0][ ][ 8][77343][1.73][ 0][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,37 @@
|
||||
[/./../../../libs/math/doc/roots/roots_table_100_msvc_X86_SSE2.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program root_n_finding_algorithms.cpp,
|
||||
Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32
|
||||
Compiled in optimise mode., _X86_SSE2]
|
||||
Fraction of full accuracy 1
|
||||
[table:root_5 5th root(28) for float, double, long double and cpp_bin_float_50 types, using _X86_SSE2
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 7][ 320][1.53][ 0][ ][ 11][ 576][2.61][ 1][ ][ 11][ 557][2.48][ 1][ ][ 12][119843][[role red 7.52]][ 0][ ]]
|
||||
[[Newton ][ 3][ 209][[role blue 1.00]][ 0][ ][ 4][ 221][[role blue 1.00]][ -1][ ][ 4][ 225][[role blue 1.00]][ -1][ ][ 6][15937][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 2][ 214][[role blue 1.02]][ 0][ ][ 3][ 256][1.16][ 0][ ][ 3][ 243][1.08][ 0][ ][ 4][28437][1.78][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 2][ 218][[role blue 1.04]][ 0][ ][ 3][ 245][1.11][ -1][ ][ 3][ 245][1.09][ -1][ ][ 4][35625][2.24][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_7 7th root(28) for float, double, long double and cpp_bin_float_50 types, using _X86_SSE2
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 493][2.18][ 1][ ][ 15][ 762][3.05][ 2][ ][ 15][ 765][3.08][ 2][ ][ 14][157343][[role red 7.09]][ 0][ ]]
|
||||
[[Newton ][ 5][ 226][[role blue 1.00]][ 0][ ][ 6][ 250][[role blue 1.00]][ 0][ ][ 6][ 248][[role blue 1.00]][ 0][ ][ 8][22187][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 4][ 257][1.14][ 0][ ][ 5][ 293][1.17][ 0][ ][ 5][ 293][1.18][ 0][ ][ 6][44062][1.99][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 5][ 285][1.26][ 0][ ][ 6][ 317][1.27][ 0][ ][ 6][ 317][1.28][ 0][ ][ 7][61406][2.77][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_11 11th root(28) for float, double, long double and cpp_bin_float_50 types, using _X86_SSE2
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 556][2.24][ -2][ ][ 14][ 784][2.94][ 2][ ][ 14][ 793][2.94][ 2][ ][ 17][235781][[role red 8.88]][ 2][ ]]
|
||||
[[Newton ][ 6][ 248][[role blue 1.00]][ 0][ ][ 7][ 267][[role blue 1.00]][ 0][ ][ 7][ 270][[role blue 1.00]][ 0][ ][ 9][26562][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 4][ 254][[role blue 1.02]][ -1][ ][ 5][ 290][1.09][ 0][ ][ 5][ 293][1.09][ 0][ ][ 6][46406][1.75][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 312][1.26][ 0][ ][ 7][ 351][1.31][ 0][ ][ 7][ 356][1.32][ 0][ ][ 8][76250][2.87][ 0][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,37 @@
|
||||
[/i:/modular-boost/libs/math/doc/roots/roots_table_75_gcc_SEE SEE2 X64 .qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program i:/modular-boost/libs/math/example/root_n_finding_algorithms.cpp,
|
||||
GNU C++ version 4.9.1, GNU libstdc++ version 20140716, Win32
|
||||
Compiled in optimise mode.]
|
||||
Fraction of full accuracy 0.75
|
||||
[table:root_5 5th root(28) for float, double, long double and cpp_bin_float_50 types.
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 7][ 312][2.50][ 0][ ][ 11][ 484][3.46][ 1][ ][ 9][ 1625][4.17][ 0][ ][ 11][67718][6.46][ 0][ ]]
|
||||
[[Newton ][ 3][ 125][1.00][ 0][ ][ 5][ 140][1.00][ -1][ ][ 4][ 390][1.00][ 0][ ][ 6][10484][1.00][ 0][ ]]
|
||||
[[Halley ][ 2][ 125][1.00][ 0][ ][ 3][ 156][1.11][ 0][ ][ 3][ 453][1.16][ 0][ ][ 4][17359][1.66][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 203][1.62][ 0][ ][ 7][ 234][1.67][ -1][ ][ 7][ 625][1.60][ 0][ ][ 8][35203][3.36][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_7 7th root(28) for float, double, long double and cpp_bin_float_50 types.
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 531][3.40][ 1][ ][ 15][ 734][4.29][ 2][ ][ 13][ 2437][5.04][ 0][ ][ 14][105421][6.48][ 0][ ]]
|
||||
[[Newton ][ 5][ 156][1.00][ 0][ ][ 7][ 171][1.00][ 0][ ][ 6][ 484][1.00][ 0][ ][ 8][16281][1.00][ 0][ ]]
|
||||
[[Halley ][ 5][ 187][1.20][ 0][ ][ 6][ 234][1.37][ 0][ ][ 5][ 796][1.64][ 0][ ][ 6][30781][1.89][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 5][ 187][1.20][ 0][ ][ 6][ 218][1.27][ 0][ ][ 6][ 546][1.13][ 0][ ][ 7][30640][1.88][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_11 11th root(28) for float, double, long double and cpp_bin_float_50 types.
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 11][ 546][3.19][ 0][ ][ 14][ 750][4.01][ 2][ ][ 14][ 2828][5.33][ 1][ ][ 17][153093][7.82][ 2][ ]]
|
||||
[[Newton ][ 6][ 171][1.00][ 0][ ][ 7][ 187][1.00][ 0][ ][ 8][ 531][1.00][ 0][ ][ 9][19578][1.00][ 0][ ]]
|
||||
[[Halley ][ 5][ 203][1.19][ 0][ ][ 6][ 234][1.25][ 0][ ][ 6][ 703][1.32][ 0][ ][ 7][36296][1.85][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 203][1.19][ 0][ ][ 7][ 250][1.34][ 0][ ][ 7][ 578][1.09][ 0][ ][ 8][38046][1.94][ 0][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,37 @@
|
||||
[/i:/modular-boost/libs/math/doc/roots/roots_table_75_gcc_X64_SSE2 _X64.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program i:/modular-boost/libs/math/example/root_n_finding_algorithms.cpp,
|
||||
GNU C++ version 4.9.1, GNU libstdc++ version 20140716, Win32
|
||||
Compiled in optimise mode., _X64_SSE2]
|
||||
Fraction of full accuracy 0.75
|
||||
[table:root_5 5th root(28) for float, double, long double and cpp_bin_float_50 types, using _X64_SSE2
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 7][ 250][2.29][ 0][ ][ 11][ 484][3.87][ 1][ ][ 9][ 1546][4.31][ 0][ ][ 11][57453][[role red 6.11]][ 0][ ]]
|
||||
[[Newton ][ 3][ 109][[role blue 1.00]][ 0][ ][ 5][ 125][[role blue 1.00]][ -1][ ][ 4][ 359][[role blue 1.00]][ 0][ ][ 6][ 9406][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 2][ 109][[role blue 1.00]][ 0][ ][ 3][ 140][[role blue 1.12]][ 0][ ][ 3][ 453][[role blue 1.26]][ 0][ ][ 4][15359][[role blue 1.63]][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 203][[role blue 1.86]][ 0][ ][ 7][ 218][[role blue 1.74]][ -1][ ][ 7][ 562][[role blue 1.57]][ 0][ ][ 8][30921][3.29][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_7 7th root(28) for float, double, long double and cpp_bin_float_50 types, using _X64_SSE2
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 468][3.74][ 1][ ][ 15][ 671][4.30][ 2][ ][ 13][ 2359][[role red 5.21]][ 0][ ][ 14][88515][[role red 6.05]][ 0][ ]]
|
||||
[[Newton ][ 5][ 125][[role blue 1.00]][ 0][ ][ 7][ 156][[role blue 1.00]][ 0][ ][ 6][ 453][[role blue 1.00]][ 0][ ][ 8][14625][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 5][ 187][[role blue 1.50]][ 0][ ][ 6][ 218][[role blue 1.40]][ 0][ ][ 5][ 718][[role blue 1.58]][ 0][ ][ 6][27843][[role blue 1.90]][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 5][ 171][[role blue 1.37]][ 0][ ][ 6][ 203][[role blue 1.30]][ 0][ ][ 6][ 515][[role blue 1.14]][ 0][ ][ 7][27640][[role blue 1.89]][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_11 11th root(28) for float, double, long double and cpp_bin_float_50 types, using _X64_SSE2
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 11][ 515][3.30][ 0][ ][ 14][ 718][4.20][ 2][ ][ 14][ 2765][[role red 5.37]][ 1][ ][ 17][132062][[role red 7.46]][ 2][ ]]
|
||||
[[Newton ][ 6][ 156][[role blue 1.00]][ 0][ ][ 7][ 171][[role blue 1.00]][ 0][ ][ 8][ 515][[role blue 1.00]][ 0][ ][ 9][17703][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 5][ 187][[role blue 1.20]][ 0][ ][ 6][ 218][[role blue 1.27]][ 0][ ][ 6][ 671][[role blue 1.30]][ 0][ ][ 7][32000][[role blue 1.81]][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 203][[role blue 1.30]][ 0][ ][ 7][ 234][[role blue 1.37]][ 0][ ][ 7][ 578][[role blue 1.12]][ 0][ ][ 8][34265][[role blue 1.94]][ 0][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,37 @@
|
||||
[/i:/modular-boost/libs/math/doc/roots/roots_table_75_msvc.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program I:\modular-boost\libs\math\example\root_n_finding_algorithms.cpp,
|
||||
Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32
|
||||
Compiled in optimise mode.]
|
||||
Fraction of full accuracy 0.75
|
||||
[table:root_5 5th root(28) for float, double, long double and cpp_bin_float_50 types
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 7][ 750][[role blue 1.00]][ 0][ ][ 11][ 1031][1.10][ 1][ ][ 11][ 1015][1.08][ 1][ ][ 11][125921][[role red 5.53]][ 0][ ]]
|
||||
[[Newton ][ 3][ 906][1.21][ 0][ ][ 5][ 953][[role blue 1.02]][ -1][ ][ 5][ 937][[role blue 1.00]][ -1][ ][ 6][22750][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 2][ 921][1.23][ 0][ ][ 3][ 937][[role blue 1.00]][ 0][ ][ 3][ 953][[role blue 1.02]][ 0][ ][ 4][40125][1.76][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 984][1.31][ 0][ ][ 7][ 1000][1.07][ -1][ ][ 7][ 1015][1.08][ -1][ ][ 8][73296][3.22][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_7 7th root(28) for float, double, long double and cpp_bin_float_50 types
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 1015][1.08][ 1][ ][ 15][ 1265][1.29][ 2][ ][ 15][ 1265][1.31][ 2][ ][ 14][198890][[role red 5.61]][ 0][ ]]
|
||||
[[Newton ][ 5][ 937][[role blue 1.00]][ 0][ ][ 7][ 984][[role blue 1.00]][ 0][ ][ 7][ 1000][1.03][ 0][ ][ 8][35437][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 5][ 984][1.05][ 0][ ][ 6][ 1078][1.10][ 0][ ][ 6][ 1046][1.08][ 0][ ][ 6][69484][1.96][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 5][ 953][[role blue 1.02]][ 0][ ][ 6][ 1000][[role blue 1.02]][ 0][ ][ 6][ 968][[role blue 1.00]][ 0][ ][ 7][67937][1.92][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_11 11th root(28) for float, double, long double and cpp_bin_float_50 types
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 11][ 1093][1.11][ 0][ ][ 14][ 1343][1.34][ 2][ ][ 14][ 1375][1.35][ 2][ ][ 17][303625][[role red 7.07]][ 2][ ]]
|
||||
[[Newton ][ 6][ 984][[role blue 1.00]][ 0][ ][ 7][ 1000][[role blue 1.00]][ 0][ ][ 7][ 1015][[role blue 1.00]][ 0][ ][ 9][42921][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 5][ 1031][1.05][ 0][ ][ 6][ 1093][1.09][ 0][ ][ 6][ 1093][1.08][ 0][ ][ 7][83062][1.94][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 1046][1.06][ 0][ ][ 7][ 1093][1.09][ 0][ ][ 7][ 1046][1.03][ 0][ ][ 8][86234][2.01][ 0][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,37 @@
|
||||
[/i:/modular-boost/libs/math/doc/roots/roots_table_75_msvc_AVX.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program I:\modular-boost\libs\math\example\root_n_finding_algorithms.cpp,
|
||||
Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32
|
||||
Compiled in optimise mode., _AVX]
|
||||
Fraction of full accuracy 0.75
|
||||
[table:root_5 5th root(28) for float, double, long double and cpp_bin_float_50 types, using _AVX
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 7][ 750][[role green 1.0000]1.00][ 0][ ][ 11][ 1031][1.10031.10][ 1][ ][ 11][ 1046][1.09761.10][ 1][ ][ 11][126781][[role red 5.5348]5.53][ 0][ ]]
|
||||
[[Newton ][ 3][ 890][1.18671.19][ 0][ ][ 5][ 937][[role green 1.0000]1.00][ -1][ ][ 5][ 953][[role green 1.0000]1.00][ -1][ ][ 6][22906][[role green 1.0000]1.00][ 0][ ]]
|
||||
[[Halley ][ 2][ 937][1.24931.25][ 0][ ][ 3][ 968][1.03311.03][ 0][ ][ 3][ 953][[role green 1.0000]1.00][ 0][ ][ 4][40265][1.75781.76][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 1000][1.33331.33][ 0][ ][ 7][ 1031][1.10031.10][ -1][ ][ 7][ 1031][1.08181.08][ -1][ ][ 8][72296][3.15623.16][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_7 7th root(28) for float, double, long double and cpp_bin_float_50 types, using _AVX
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 984][1.03251.03][ 1][ ][ 15][ 1218][1.21801.22][ 2][ ][ 15][ 1250][1.29131.29][ 2][ ][ 14][191500][[role red 5.5965]5.60][ 0][ ]]
|
||||
[[Newton ][ 5][ 953][[role green 1.0000]1.00][ 0][ ][ 7][ 1062][1.06201.06][ 0][ ][ 7][ 968][[role green 1.0000]1.00][ 0][ ][ 8][34218][[role green 1.0000]1.00][ 0][ ]]
|
||||
[[Halley ][ 5][ 1000][1.04931.05][ 0][ ][ 6][ 1109][1.10901.11][ 0][ ][ 6][ 1078][1.11361.11][ 0][ ][ 6][66765][1.95121.95][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 5][ 984][1.03251.03][ 0][ ][ 6][ 1000][[role green 1.0000]1.00][ 0][ ][ 6][ 1000][1.03311.03][ 0][ ][ 7][65703][1.92011.92][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_11 11th root(28) for float, double, long double and cpp_bin_float_50 types, using _AVX
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 11][ 1062][1.09711.10][ 0][ ][ 14][ 1281][1.26211.26][ 2][ ][ 14][ 1328][1.32801.33][ 2][ ][ 17][297875][[role red 7.2323]7.23][ 2][ ]]
|
||||
[[Newton ][ 6][ 968][[role green 1.0000]1.00][ 0][ ][ 7][ 1031][[role green 1.0158]1.02][ 0][ ][ 7][ 1000][[role green 1.0000]1.00][ 0][ ][ 9][41187][[role green 1.0000]1.00][ 0][ ]]
|
||||
[[Halley ][ 5][ 1015][1.04861.05][ 0][ ][ 6][ 1171][1.15371.15][ 0][ ][ 6][ 1093][1.09301.09][ 0][ ][ 7][77984][1.89341.89][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 1000][1.03311.03][ 0][ ][ 7][ 1015][[role green 1.0000]1.00][ 0][ ][ 7][ 1046][1.04601.05][ 0][ ][ 8][77781][1.88851.89][ 0][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,37 @@
|
||||
[/i:/modular-boost/libs/math/doc/roots/roots_table_75_msvc_X86.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program I:\modular-boost\libs\math\example\root_n_finding_algorithms.cpp,
|
||||
Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32
|
||||
Compiled in optimise mode., _X86]
|
||||
Fraction of full accuracy 0.75
|
||||
[table:root_5 5th root(28) for float, double, long double and cpp_bin_float_50 types, using _X86
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 8][ 1062][1.06][ -2][ ][ 11][ 1171][1.21][ 1][ ][ 11][ 1171][1.21][ 1][ ][ 11][122375][[role red 5.45]][ 0][ ]]
|
||||
[[Newton ][ 3][ 1000][[role blue 1.00]][ 0][ ][ 5][ 968][[role blue 1.00]][ -1][ ][ 5][ 968][[role blue 1.00]][ -1][ ][ 6][22468][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 3][ 1062][1.06][ 0][ ][ 3][ 984][[role blue 1.02]][ 0][ ][ 3][ 984][[role blue 1.02]][ 0][ ][ 4][39234][1.75][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 7][ 1234][1.23][ 0][ ][ 7][ 1046][1.08][ -1][ ][ 7][ 1031][1.07][ -1][ ][ 8][70406][3.13][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_7 7th root(28) for float, double, long double and cpp_bin_float_50 types, using _X86
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 1562][1.47][ 1][ ][ 15][ 1484][1.48][ 2][ ][ 15][ 1453][1.45][ 2][ ][ 14][202265][[role red 5.41]][ 0][ ]]
|
||||
[[Newton ][ 5][ 1062][[role blue 1.00]][ 0][ ][ 7][ 1000][[role blue 1.00]][ 0][ ][ 7][ 1000][[role blue 1.00]][ 0][ ][ 8][37359][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 5][ 1156][1.09][ 0][ ][ 6][ 1125][1.13][ 0][ ][ 6][ 1109][1.11][ 0][ ][ 6][71843][1.92][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 5][ 1125][1.06][ 0][ ][ 6][ 1031][[role blue 1.03]][ 0][ ][ 6][ 1031][[role blue 1.03]][ 0][ ][ 7][67875][1.82][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_11 11th root(28) for float, double, long double and cpp_bin_float_50 types, using _X86
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 11][ 1703][1.40][ 0][ ][ 14][ 1609][1.52][ 2][ ][ 14][ 1562][1.47][ 2][ ][ 17][290031][[role red 6.93]][ 2][ ]]
|
||||
[[Newton ][ 6][ 1218][[role blue 1.00]][ 0][ ][ 7][ 1062][[role blue 1.00]][ 0][ ][ 7][ 1062][[role blue 1.00]][ 0][ ][ 9][41843][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 5][ 1265][[role blue 1.04]][ -1][ ][ 6][ 1125][1.06][ 0][ ][ 6][ 1125][1.06][ 0][ ][ 7][75937][1.81][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 1296][1.06][ 0][ ][ 7][ 1093][[role blue 1.03]][ 0][ ][ 7][ 1078][[role blue 1.02]][ 0][ ][ 8][77500][1.85][ 0][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,37 @@
|
||||
[/i:/modular-boost/libs/math/doc/roots/roots_table_75_msvc_X86_SSE2 .qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[h6 Program I:\modular-boost\libs\math\example\root_n_finding_algorithms.cpp,
|
||||
Microsoft Visual C++ version 12.0, Dinkumware standard library version 610, Win32
|
||||
Compiled in optimise mode., _X86_SSE2 ]
|
||||
Fraction of full accuracy 0.75
|
||||
[table:root_5 5th root(28) for float, double, long double and cpp_bin_float_50 types, using _X86_SSE2
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 7][ 750][[role blue 1.00]][ 0][ ][ 11][ 1031][1.10][ 1][ ][ 11][ 1031][1.12][ 1][ ][ 11][125250][[role red 5.53]][ 0][ ]]
|
||||
[[Newton ][ 3][ 906][1.21][ 0][ ][ 5][ 937][[role blue 1.00]][ -1][ ][ 5][ 953][[role blue 1.03]][ -1][ ][ 6][22640][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 2][ 921][1.23][ 0][ ][ 3][ 953][[role blue 1.02]][ 0][ ][ 3][ 921][[role blue 1.00]][ 0][ ][ 4][39390][1.74][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 984][1.31][ 0][ ][ 7][ 1031][1.10][ -1][ ][ 7][ 1031][1.12][ -1][ ][ 8][72515][3.20][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_7 7th root(28) for float, double, long double and cpp_bin_float_50 types, using _X86_SSE2
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 12][ 1000][1.09][ 1][ ][ 15][ 1218][1.28][ 2][ ][ 15][ 1218][1.26][ 2][ ][ 14][192640][[role red 5.64]][ 0][ ]]
|
||||
[[Newton ][ 5][ 921][[role blue 1.00]][ 0][ ][ 7][ 953][[role blue 1.00]][ 0][ ][ 7][ 968][[role blue 1.00]][ 0][ ][ 8][34156][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 5][ 1000][1.09][ 0][ ][ 6][ 1031][1.08][ 0][ ][ 6][ 1031][1.07][ 0][ ][ 6][66625][1.95][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 5][ 968][1.05][ 0][ ][ 6][ 968][[role blue 1.02]][ 0][ ][ 6][ 1015][[role blue 1.05]][ 0][ ][ 7][64953][1.90][ 0][ ]]
|
||||
] [/end of table root]
|
||||
[table:root_11 11th root(28) for float, double, long double and cpp_bin_float_50 types, using _X86_SSE2
|
||||
[[][float][][][] [][double][][][] [][long d][][][] [][cpp50][][]]
|
||||
[[Algo ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ][Its][Times][Norm][Dis][ ]]
|
||||
[[TOMS748 ][ 11][ 1046][1.08][ 0][ ][ 14][ 1296][1.32][ 2][ ][ 14][ 1312][1.33][ 2][ ][ 17][288437][[role red 6.98]][ 2][ ]]
|
||||
[[Newton ][ 6][ 968][[role blue 1.00]][ 0][ ][ 7][ 984][[role blue 1.00]][ 0][ ][ 7][ 984][[role blue 1.00]][ 0][ ][ 9][41328][[role blue 1.00]][ 0][ ]]
|
||||
[[Halley ][ 5][ 1000][[role blue 1.03]][ 0][ ][ 6][ 1046][1.06][ 0][ ][ 6][ 1046][1.06][ 0][ ][ 7][78593][1.90][ 0][ ]]
|
||||
[[Schr'''ö'''der][ 6][ 1015][[role blue 1.05]][ 0][ ][ 7][ 1046][1.06][ 0][ ][ 7][ 1046][1.06][ 0][ ][ 8][78218][1.89][ 0][ ]]
|
||||
] [/end of table root]
|
||||
@@ -0,0 +1,498 @@
|
||||
[section:roots_noderiv Root Finding Without Derivatives]
|
||||
|
||||
[h4 Synopsis]
|
||||
|
||||
``
|
||||
#include <boost/math/tools/roots.hpp>
|
||||
``
|
||||
|
||||
namespace boost { namespace math {
|
||||
namespace tools { // Note namespace boost::math::tools.
|
||||
// Bisection
|
||||
template <class F, class T, class Tol>
|
||||
std::pair<T, T>
|
||||
bisect(
|
||||
F f,
|
||||
T min,
|
||||
T max,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter);
|
||||
|
||||
template <class F, class T, class Tol>
|
||||
std::pair<T, T>
|
||||
bisect(
|
||||
F f,
|
||||
T min,
|
||||
T max,
|
||||
Tol tol);
|
||||
|
||||
template <class F, class T, class Tol, class ``__Policy``>
|
||||
std::pair<T, T>
|
||||
bisect(
|
||||
F f,
|
||||
T min,
|
||||
T max,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter,
|
||||
const ``__Policy``&);
|
||||
|
||||
// Bracket and Solve Root
|
||||
template <class F, class T, class Tol>
|
||||
std::pair<T, T>
|
||||
bracket_and_solve_root(
|
||||
F f,
|
||||
const T& guess,
|
||||
const T& factor,
|
||||
bool rising,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter);
|
||||
|
||||
template <class F, class T, class Tol, class ``__Policy``>
|
||||
std::pair<T, T>
|
||||
bracket_and_solve_root(
|
||||
F f,
|
||||
const T& guess,
|
||||
const T& factor,
|
||||
bool rising,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter,
|
||||
const ``__Policy``&);
|
||||
|
||||
// TOMS 748 algorithm
|
||||
template <class F, class T, class Tol>
|
||||
std::pair<T, T>
|
||||
toms748_solve(
|
||||
F f,
|
||||
const T& a,
|
||||
const T& b,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter);
|
||||
|
||||
template <class F, class T, class Tol, class ``__Policy``>
|
||||
std::pair<T, T>
|
||||
toms748_solve(
|
||||
F f,
|
||||
const T& a,
|
||||
const T& b,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter,
|
||||
const ``__Policy``&);
|
||||
|
||||
template <class F, class T, class Tol>
|
||||
std::pair<T, T>
|
||||
toms748_solve(
|
||||
F f,
|
||||
const T& a,
|
||||
const T& b,
|
||||
const T& fa,
|
||||
const T& fb,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter);
|
||||
|
||||
template <class F, class T, class Tol, class ``__Policy``>
|
||||
std::pair<T, T>
|
||||
toms748_solve(
|
||||
F f,
|
||||
const T& a,
|
||||
const T& b,
|
||||
const T& fa,
|
||||
const T& fb,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter,
|
||||
const ``__Policy``&);
|
||||
|
||||
// Termination conditions:
|
||||
template <class T>
|
||||
struct eps_tolerance;
|
||||
|
||||
struct equal_floor;
|
||||
struct equal_ceil;
|
||||
struct equal_nearest_integer;
|
||||
|
||||
}}} // boost::math::tools namespaces
|
||||
|
||||
[h4 Description]
|
||||
|
||||
These functions solve the root of some function ['f(x)] -
|
||||
['without the need for any derivatives of ['f(x)]].
|
||||
|
||||
The `bracket_and_solve_root` functions use __root_finding_TOMS748
|
||||
by Alefeld, Potra and Shi that is asymptotically the most efficient known,
|
||||
and has been shown to be optimal for a certain classes of smooth functions.
|
||||
Variants with and without __policy_section are provided.
|
||||
|
||||
Alternatively, __bisect is a simple __bisection_wikipedia routine which can be useful
|
||||
in its own right in some situations, or alternatively for narrowing
|
||||
down the range containing the root, prior to calling a more advanced
|
||||
algorithm.
|
||||
|
||||
All the algorithms in this section reduce the diameter of the enclosing
|
||||
interval with the same asymptotic efficiency with which they locate the
|
||||
root. This is in contrast to the derivative based methods which may ['never]
|
||||
significantly reduce the enclosing interval, even though they rapidly approach
|
||||
the root. This is also in contrast to some other derivative-free methods
|
||||
(for example, Brent's method described at
|
||||
[@http://en.wikipedia.org/wiki/Brent%27s_method Brent-Dekker)]
|
||||
which only reduces the enclosing interval on the final step.
|
||||
Therefore these methods return a `std::pair` containing the enclosing interval found,
|
||||
and accept a function object specifying the termination condition.
|
||||
|
||||
Three function objects are provided for ready-made termination conditions:
|
||||
|
||||
* ['eps_tolerance] causes termination when the relative error in the enclosing
|
||||
interval is below a certain threshold.
|
||||
* ['equal_floor] and ['equal_ceil] are useful for certain statistical applications
|
||||
where the result is known to be an integer.
|
||||
* Other user-defined termination conditions are likely to be used
|
||||
only rarely, but may be useful in some specific circumstances.
|
||||
|
||||
[section:bisect Bisection]
|
||||
|
||||
template <class F, class T, class Tol>
|
||||
std::pair<T, T>
|
||||
bisect( // Unlimited iterations.
|
||||
F f,
|
||||
T min,
|
||||
T max,
|
||||
Tol tol);
|
||||
|
||||
template <class F, class T, class Tol>
|
||||
std::pair<T, T>
|
||||
bisect( // Limited iterations.
|
||||
F f,
|
||||
T min,
|
||||
T max,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter);
|
||||
|
||||
template <class F, class T, class Tol, class ``__Policy``>
|
||||
std::pair<T, T>
|
||||
bisect( // Specified policy.
|
||||
F f,
|
||||
T min,
|
||||
T max,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter,
|
||||
const ``__Policy``&);
|
||||
|
||||
These functions locate the root using __bisection_wikipedia.
|
||||
|
||||
`bisect` function arguments are:
|
||||
|
||||
[variablelist
|
||||
[[f] [A unary functor which is the function ['f(x)] whose root is to be found.]]
|
||||
[[min] [The left bracket of the interval known to contain the root.]]
|
||||
[[max] [The right bracket of the interval known to contain the root.[br]
|
||||
It is a precondition that ['min < max] and ['f(min)*f(max) <= 0],
|
||||
the function raises an __evaluation_error if these preconditions are violated.
|
||||
The action taken on error is controlled by the __Policy template argument: the default behavior is to
|
||||
throw a ['boost::math::evaluation_error]. If the __Policy is changed to not throw
|
||||
then it returns ['std::pair<T>(min, min)].]]
|
||||
[[tol] [A binary functor that specifies the termination condition: the function
|
||||
will return the current brackets enclosing the root when ['tol(min, max)] becomes true.
|
||||
See also __root_termination.]]
|
||||
[[max_iter][The maximum number of invocations of ['f(x)] to make while searching for the root. On exit, this is updated to the actual number of invocations performed.]]
|
||||
]
|
||||
|
||||
[optional_policy]
|
||||
|
||||
[*Returns]: a pair of values ['r] that bracket the root so that:
|
||||
|
||||
f(r.first) * f(r.second) <= 0
|
||||
|
||||
and either
|
||||
|
||||
tol(r.first, r.second) == true
|
||||
|
||||
or
|
||||
|
||||
max_iter >= m
|
||||
|
||||
where ['m] is the initial value of ['max_iter] passed to the function.
|
||||
|
||||
In other words, it's up to the caller to verify whether termination occurred
|
||||
as a result of exceeding ['max_iter] function invocations (easily done by
|
||||
checking the updated value of ['max_iter] when the function returns), rather than
|
||||
because the termination condition ['tol] was satisfied.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:bracket_solve Bracket and Solve Root]
|
||||
|
||||
template <class F, class T, class Tol>
|
||||
std::pair<T, T>
|
||||
bracket_and_solve_root(
|
||||
F f,
|
||||
const T& guess,
|
||||
const T& factor,
|
||||
bool rising,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter);
|
||||
|
||||
template <class F, class T, class Tol, class ``__Policy``>
|
||||
std::pair<T, T>
|
||||
bracket_and_solve_root(
|
||||
F f,
|
||||
const T& guess,
|
||||
const T& factor,
|
||||
bool rising,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter,
|
||||
const ``__Policy``&);
|
||||
|
||||
`bracket_and_solve_root` is a convenience function that calls __root_finding_TOMS748 internally
|
||||
to find the root of ['f(x)]. It is generally much easier to use this function rather than __root_finding_TOMS748, since it
|
||||
does the hard work of bracketing the root for you. It's bracketing routines are quite robust and will
|
||||
usually be more foolproof than home-grown routines, unless the function can be analysed to yield tight
|
||||
brackets.
|
||||
|
||||
Note that this routine can only be used when:
|
||||
|
||||
* ['f(x)] is monotonic in the half of the real axis containing ['guess].
|
||||
* The value of the inital guess must have the same sign as the root: the function
|
||||
will ['never cross the origin] when searching for the root.
|
||||
* The location of the root should be known at least approximately,
|
||||
if the location of the root differs by many orders of magnitude
|
||||
from ['guess] then many iterations will be needed to bracket the root in spite of
|
||||
the special heuristics used to guard against this very situation. A typical example would be
|
||||
setting the initial guess to 0.1, when the root is at 1e-300.
|
||||
|
||||
The `bracket_and_solve_root` parameters are:
|
||||
|
||||
[variablelist
|
||||
[[f][A unary functor that is the function whose root is to be solved.
|
||||
['f(x)] must be uniformly increasing or decreasing on ['x].]]
|
||||
[[guess][An initial approximation to the root.]]
|
||||
[[factor][A scaling factor that is used to bracket the root: the value
|
||||
/guess/ is multiplied (or divided as appropriate) by /factor/
|
||||
until two values are found that bracket the root. A value
|
||||
such as 2 is a typical choice for ['factor].
|
||||
In addition ['factor] will be multiplied by 2 every 32 iterations:
|
||||
this is to guard against a really very bad initial guess, typically these occur
|
||||
when it's known the result is very large or small, but not the exact order
|
||||
of magnitude.]]
|
||||
[[rising][Set to ['true] if ['f(x)] is rising on /x/ and /false/ if ['f(x)]
|
||||
is falling on /x/. This value is used along with the result
|
||||
of /f(guess)/ to determine if /guess/ is
|
||||
above or below the root.]]
|
||||
[[tol] [A binary functor that determines the termination condition for the search
|
||||
for the root. /tol/ is passed the current brackets at each step,
|
||||
when it returns true then the current brackets are returned as the pair result.
|
||||
See also __root_termination.]]
|
||||
[[max_iter] [The maximum number of function invocations to perform in the search
|
||||
for the root. On exit is set to the actual number of invocations performed.]]
|
||||
]
|
||||
|
||||
[optional_policy]
|
||||
|
||||
[*Returns]: a pair of values ['r] that bracket the root so that:
|
||||
|
||||
f(r.first) * f(r.second) <= 0
|
||||
|
||||
and either
|
||||
|
||||
tol(r.first, r.second) == true
|
||||
|
||||
or
|
||||
|
||||
max_iter >= m
|
||||
|
||||
where ['m] is the initial value of ['max_iter] passed to the function.
|
||||
|
||||
In other words, it's up to the caller to verify whether termination occurred
|
||||
as a result of exceeding ['max_iter] function invocations (easily done by
|
||||
checking the value of ['max_iter] when the function returns), rather than
|
||||
because the termination condition ['tol] was satisfied.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:TOMS748 Algorithm TOMS 748: Alefeld, Potra and Shi: Enclosing zeros of continuous functions]
|
||||
|
||||
template <class F, class T, class Tol>
|
||||
std::pair<T, T>
|
||||
toms748_solve(
|
||||
F f,
|
||||
const T& a,
|
||||
const T& b,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter);
|
||||
|
||||
template <class F, class T, class Tol, class ``__Policy``>
|
||||
std::pair<T, T>
|
||||
toms748_solve(
|
||||
F f,
|
||||
const T& a,
|
||||
const T& b,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter,
|
||||
const ``__Policy``&);
|
||||
|
||||
template <class F, class T, class Tol>
|
||||
std::pair<T, T>
|
||||
toms748_solve(
|
||||
F f,
|
||||
const T& a,
|
||||
const T& b,
|
||||
const T& fa,
|
||||
const T& fb,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter);
|
||||
|
||||
template <class F, class T, class Tol, class ``__Policy``>
|
||||
std::pair<T, T>
|
||||
toms748_solve(
|
||||
F f,
|
||||
const T& a,
|
||||
const T& b,
|
||||
const T& fa,
|
||||
const T& fb,
|
||||
Tol tol,
|
||||
boost::uintmax_t& max_iter,
|
||||
const ``__Policy``&);
|
||||
|
||||
These functions implement TOMS Algorithm 748: it uses a mixture of
|
||||
cubic, quadratic and linear (secant) interpolation to locate the root of
|
||||
['f(x)]. The two pairs of functions differ only by whether values for ['f(a)] and
|
||||
['f(b)] are already available.
|
||||
|
||||
Generally speaking it is easier (and often more efficient) to use __bracket_solve
|
||||
rather than trying to bracket the root yourself as this function requires.
|
||||
|
||||
This function is provided rather than [@http://en.wikipedia.org/wiki/Brent%27s_method Brent's method] as it is known to be more
|
||||
effient in many cases (it is asymptotically the most efficient known,
|
||||
and has been shown to be optimal for a certain classes of smooth functions).
|
||||
It also has the useful property of decreasing the bracket size
|
||||
with each step, unlike Brent's method which only shrinks the enclosing interval in the
|
||||
final step. This makes it particularly useful when you need a result where the ends
|
||||
of the interval round to the same integer: as often happens in statistical applications
|
||||
for example. In this situation the function is able to exit after a much smaller
|
||||
number of iterations than would otherwise be possible.
|
||||
|
||||
The __root_finding_TOMS748 parameters are:
|
||||
|
||||
[variablelist
|
||||
[[f] [A unary functor that is the function whose root is to be solved.
|
||||
f(x) need not be uniformly increasing or decreasing on ['x] and
|
||||
may have multiple roots. However, the bounds given must bracket a single root.]]
|
||||
[[a] [The lower bound for the initial bracket of the root.]]
|
||||
[[b] [The upper bound for the initial bracket of the root.
|
||||
It is a precondition that ['a < b] and that ['a] and ['b]
|
||||
bracket the root to find so that ['f(a) * f(b) < 0].]]
|
||||
[[fa] [Optional: the value of ['f(a)].]]
|
||||
[[fb] [Optional: the value of ['f(b)].]]
|
||||
[[tol] [A binary functor that determines the termination condition for the search
|
||||
for the root. ['tol] is passed the current brackets at each step,
|
||||
when it returns true, then the current brackets are returned as the result.
|
||||
See also __root_termination.]]
|
||||
[[max_iter] [The maximum number of function invocations to perform in the search
|
||||
for the root. On exit, ['max_iter] is set to actual number of function
|
||||
invocations used.]]
|
||||
]
|
||||
|
||||
[optional_policy]
|
||||
|
||||
`toms748_solve` returns: a pair of values ['r] that bracket the root so that:
|
||||
|
||||
f(r.first) * f(r.second) <= 0
|
||||
|
||||
and either
|
||||
|
||||
tol(r.first, r.second) == true
|
||||
|
||||
or
|
||||
|
||||
max_iter >= m
|
||||
|
||||
where ['m] is the initial value of ['max_iter] passed to the function.
|
||||
|
||||
In other words, it's up to the caller to verify whether termination occurred
|
||||
as a result of exceeding ['max_iter] function invocations (easily done by
|
||||
checking the updated value of ['max_iter]
|
||||
against its previous value passed as parameter),
|
||||
rather than because the termination condition ['tol] was satisfied.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:brent Brent-Decker Algorithm]
|
||||
|
||||
The [@http://en.wikipedia.org/wiki/Brent%27s_method Brent-Dekker algorithm], although very well know,
|
||||
is not provided by this library as __root_finding_TOMS748 or
|
||||
its slightly easier to use variant __bracket_solve are superior and provide equivalent functionality.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:root_termination Termination Condition Functors]
|
||||
|
||||
template <class T>
|
||||
struct eps_tolerance
|
||||
{
|
||||
eps_tolerance();
|
||||
eps_tolerance(int bits);
|
||||
bool operator()(const T& a, const T& b)const;
|
||||
};
|
||||
|
||||
`eps_tolerance` is the usual termination condition used with these root finding functions.
|
||||
Its `operator()` will return true when the relative distance between ['a] and ['b]
|
||||
is less than four times the machine epsilon for T, or 2[super 1-bits], whichever is
|
||||
the larger. In other words, you set ['bits] to the number of bits of precision you
|
||||
want in the result. The minimal tolerance of ['four times the machine epsilon of type T] is
|
||||
required to ensure that we get back a bracketing interval, since this must clearly
|
||||
be at greater than one epsilon in size. While in theory a maximum distance of twice
|
||||
machine epsilon is possible to achieve, in practice this results in a great deal of "thrashing"
|
||||
given that the function whose root is being found can only ever be accurate to 1 epsilon at best.
|
||||
|
||||
struct equal_floor
|
||||
{
|
||||
equal_floor();
|
||||
template <class T> bool operator()(const T& a, const T& b)const;
|
||||
};
|
||||
|
||||
This termination condition is used when you want to find an integer result
|
||||
that is the ['floor] of the true root. It will terminate as soon as both ends
|
||||
of the interval have the same ['floor].
|
||||
|
||||
struct equal_ceil
|
||||
{
|
||||
equal_ceil();
|
||||
template <class T> bool operator()(const T& a, const T& b)const;
|
||||
};
|
||||
|
||||
This termination condition is used when you want to find an integer result
|
||||
that is the ['ceil] of the true root. It will terminate as soon as both ends
|
||||
of the interval have the same ['ceil].
|
||||
|
||||
struct equal_nearest_integer
|
||||
{
|
||||
equal_nearest_integer();
|
||||
template <class T> bool operator()(const T& a, const T& b)const;
|
||||
};
|
||||
|
||||
This termination condition is used when you want to find an integer result
|
||||
that is the /closest/ to the true root. It will terminate as soon as both ends
|
||||
of the interval round to the same nearest integer.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:implementation Implementation]
|
||||
|
||||
The implementation of the bisection algorithm is extremely straightforward
|
||||
and not detailed here.
|
||||
|
||||
__TOMS748 is described in detail in:
|
||||
|
||||
['Algorithm 748: Enclosing Zeros of Continuous Functions,
|
||||
G. E. Alefeld, F. A. Potra and Yixun Shi,
|
||||
ACM Transactions on Mathematica1 Software, Vol. 21. No. 3. September 1995.
|
||||
Pages 327-344.]
|
||||
|
||||
The implementation here is a faithful translation of this paper into C++.
|
||||
|
||||
[endsect]
|
||||
[endsect] [/section:roots_noderiv Root Finding Without Derivatives]
|
||||
|
||||
[/
|
||||
Copyright 2006, 2010, 2015 John Maddock and Paul A. Bristow.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
[/i:/modular-boost/libs/math/doc/roots/type_info_table_100_msvc.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[h6 Fraction of maximum possible bits of accuracy required is 1.0.]
|
||||
|
||||
[table:type_info_100_msvc Digits for float, double, long double and cpp_bin_float_50
|
||||
[[type name] [max_digits10] [binary digits] [required digits]]
|
||||
[[float][9][24][24]]
|
||||
[[float][17][53][53]]
|
||||
[[long double][17][53][53]]
|
||||
[[cpp_bin_float_50][52][168][168]]
|
||||
] [/table table_id_msvc]
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
[/i:/modular-boost/libs/math/doc/roots/type_info_table_75_msvc.qbk
|
||||
Copyright 2015 Paul A. Bristow.
|
||||
Copyright 2015 John Maddock.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[h6 Fraction of maximum possible bits of accuracy required is 0.75.]
|
||||
|
||||
[table:type_info_75_msvc Digits for float, double, long double and cpp_bin_float_50
|
||||
[[type name] [max_digits10] [binary digits] [required digits]]
|
||||
[[float][9][24][18]]
|
||||
[[float][17][53][39]]
|
||||
[[long double][17][53][39]]
|
||||
[[cpp_bin_float_50][52][168][126]]
|
||||
] [/table table_id_msvc]
|
||||
|
||||
Reference in New Issue
Block a user