quadratic (p-o)'S'S(p-o) solve for o, S S is a single scale factor
More...
Public Member Functions |
| val ($x, $a) |
| grad ($x, $a, $a_k) |
| z = (p-o)'S'S(p-o) dz/dp = 2S'S(p-o)
|
| initial () |
| testdata () |
Detailed Description
quadratic (p-o)'S'S(p-o) solve for o, S S is a single scale factor
Definition at line 7 of file LMQuadTest.php.
Member Function Documentation
LMQuadTest::grad |
( |
|
$x, |
|
|
|
$a, |
|
|
|
$a_k |
|
) |
| |
z = (p-o)'S'S(p-o) dz/dp = 2S'S(p-o)
z = (s*(px-ox))^2 + (s*(py-oy))^2 dz/dox = -2(s*(px-ox))*s dz/ds = 2*s*[(px-ox)^2 + (py-oy)^2]
z = (s*dx)^2 + (s*dy)^2 dz/ds = 2(s*dx)*dx + 2(s*dy)*dy
- Parameters
-
| array[] | $x |
| array[] | $a |
int | $a_k | |
| array[] | $a |
Definition at line 44 of file LMQuadTest.php.
References $x, and elseif().
{
if (count($a) != 3) die ("Wrong number of elements in array a");
if (count(
$x) != 2) die (
"Wrong number of elements in array x");
if ($a_k < 3) die ("a_k=".$a_k);
$ox = $a[0];
$oy = $a[1];
$s = $a[2];
if ($a_k == 0)
return -2.*$s*$s*$dx;
return -2.*$s*$s*$dy;
else
return 2.*$s*($dx*$dx + $dy*$dy);
}
- Returns
- array[] $a
Definition at line 68 of file LMQuadTest.php.
{
$a[0] = 0.05;
$a[1] = 0.1;
$a[2] = 1.0;
return $a;
}
- Returns
- Object[] $a
Definition at line 80 of file LMQuadTest.php.
References $x, $y, and val().
{
$npts = 25;
$a[0] = 0.;
$a[1] = 0.;
$a[2] = 0.9;
$i = 0;
for ($r = -2; $r <= 2; ++$r) {
for ($c = -2; $c <= 2; ++$c) {
print(
"Quad ".$c.
",".$r.
" -> ".
$y[$i].
"<br />");
$s[$i] = 1.;
++$i;
}
}
print("quad x= ");
$qx->print(10, 2);
print("quad y= ");
$qy->print(10, 2);
$o[1] = $a;
$o[3] = $s;
return $o;
}
LMQuadTest::val |
( |
|
$x, |
|
|
|
$a |
|
) |
| |
- Parameters
-
Definition at line 13 of file LMQuadTest.php.
References $x.
Referenced by testdata().
{
if (count($a) != 3) die ("Wrong number of elements in array a");
if (count(
$x) != 2) die (
"Wrong number of elements in array x");
$ox = $a[0];
$oy = $a[1];
$s = $a[2];
$sdx = $s * (
$x[0] - $ox);
$sdy = $s * (
$x[1] - $oy);
return ($sdx * $sdx) + ($sdy * $sdy);
}
The documentation for this class was generated from the following file: