User:Sintel/Generator optimization: Difference between revisions
No edit summary |
No edit summary |
||
| Line 23: | Line 23: | ||
== Least squares solution == | == Least squares solution == | ||
If we want more than <math>n</math> intervals to be just, the result is an overconstrained system, and no solutions can be found. | If we want more than <math>n</math> intervals to be just, the result is an overconstrained system, and no solutions can be found. | ||
However, we can instead obtain an approximate solution | However, we can instead obtain an approximate solution that minimizes the squared error. | ||
If <math>V</math> is now a <math>k \times m</math> matrix (<math>m \gt n</math>), then the error for these intervals is: | If <math>V</math> is now a <math>k \times m</math> matrix (where <math>m \gt n</math>), then the error for these intervals is: | ||
$$ | $$ | ||
gMV - jV | gMV - jV | ||
| Line 34: | Line 34: | ||
Note that since we are working with row vectors, the norm is defined such that <math>\left\| x \right\|^2 = xx^{\mathsf T}</math>. | Note that since we are working with row vectors, the norm is defined such that <math>\left\| x \right\|^2 = xx^{\mathsf T}</math>. | ||
Differentiating with respect to <math>g | Differentiating with respect to <math>g</math>: | ||
$$ | $$ | ||
\begin{gather} | \begin{gather} | ||
& \frac{\partial }{\partial g | & \frac{\partial }{\partial g} \| gMV - jV \|^2 \\ | ||
= & \frac{\partial }{\partial g | = & \frac{\partial }{\partial g} (gMV - jV)(gMV - jV)^{\mathsf T} \\ | ||
= & \frac{\partial }{\partial g | = & \frac{\partial }{\partial g} (gMVV^{\mathsf T}M^{\mathsf T}g^{\mathsf T} - 2jVV^{\mathsf T}M^{\mathsf T}g^{\mathsf T} + jVV^{\mathsf T}j^{\mathsf T}) \\ | ||
= & 2gMVV^{\mathsf T}M^{\mathsf T} - 2jVV^{\mathsf T}M^{\mathsf T} = 0 | = & 2gMVV^{\mathsf T}M^{\mathsf T} - 2jVV^{\mathsf T}M^{\mathsf T} = 0 | ||
\end{gather} | \end{gather} | ||