Skip to content
Permalink
Browse files
add linear conjugate gradient example
  • Loading branch information
benfred committed Dec 4, 2016
1 parent 31b2d55 commit 23ffd787684110adac59d1ddb7241f97329b5cbc
Showing with 129 additions and 0 deletions.
  1. +129 −0 examples/conjugate_gradient_solve.html
@@ -0,0 +1,129 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Linear Conjugate Gradient Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Ben Frederickson">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" />
<style>

.ticks {
font: 10px sans-serif;
}

.track,
.track-inset,
.track-overlay {
stroke-linecap: round;
}

.track {
stroke: #000;
stroke-opacity: 0.3;
stroke-width: 10px;
}

.track-inset {
stroke: #ddd;
stroke-width: 8px;
}

.track-overlay {
pointer-events: stroke;
stroke-width: 50px;
cursor: crosshair;
}

.handle {
fill: #fff;
stroke: #000;
stroke-opacity: 0.5;
stroke-width: 1.25px;
}
</style>

</head>

<body>
<div class="container">
<div class = "row"><div class="col-md-6 col-md-offset-3">

<div id ="cg" >
<div style="text-align:center"><div style="display:inline-block;">
<h4>
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="function_sig">
\(f(x, y) \)
</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a class="function_matyas">
\(.26 (x^2 + y^2) + .48 x y \)
</a></li>
<li><a class="function_booth">
\((x + 2 y - 7)^2 + ( 2x + y - 5) ^2\)
</a></li>
</ul>
</div>
<span>\(=\)</span>
<span class="function_label">
\((1-x)^2 + 100 (y - x^2) ^2\)
</span>
</h4>
</div></div>

<div id="vis"></div>
<!--
<div class="row">
<form class="form-inline" role="form">
<div class="form-group col-xs-12 col-md-12">
<div style="text-align:center"><div style="display:inline-block;">
<label class="r-only" for="learningrate">Learning Rate \(\delta\)
<span id="learningratevalue">= 0.05</span>
</label>
</div></div>
<div id="learningrate"></div>
</div>
</form>
</div>
-->
<div style="text-align:center"><div style="display:inline-block;">
<div class="row">
<div class ="iterations"></div>
</div>
</div></div>
</div>
</div>
</div>

</body>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.3/d3.min.js"></script>
<script src="../build/fmin.js"></script>
<script src="../build/fmin_vis.js"></script>

<script>
var cg_plot = new fmin_vis.ConjugateGradientSolverContour(d3.select("#cg"));
</script>

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
extensions: ["tex2jax.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
processEscapes: true
},
"HTML-CSS": { availableFonts: ["TeX"] }
});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
</html>

0 comments on commit 23ffd78

Please sign in to comment.