Skip to content
Snippets Groups Projects
Commit 95a38681 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Return differences

parent 390cba07
Branches
No related tags found
No related merge requests found
...@@ -37,10 +37,9 @@ DEFUN_DLD(duneminimise, args, nargout, "the help string") { ...@@ -37,10 +37,9 @@ DEFUN_DLD(duneminimise, args, nargout, "the help string") {
SampleFunctional::SmallVector correction; SampleFunctional::SmallVector correction;
Dune::minimise(J, start, correction); Dune::minimise(J, start, correction);
start += correction;
ColumnVector ret(dim); ColumnVector ret(dim);
Dune::duneToOctave<dim>(start, ret); Dune::duneToOctave<dim>(correction, ret);
return octave_value(ret); return octave_value(ret);
} }
...@@ -24,12 +24,12 @@ oldvec = [279; 0]; ...@@ -24,12 +24,12 @@ oldvec = [279; 0];
olddiff = [ 0; 0]; olddiff = [ 0; 0];
for i=1:10 for i=1:10
newvec=duneminimise(oldvec); newdiff=duneminimise(oldvec);
newvec = oldvec + newdiff;
line([oldvec(1) newvec(1)], ... line([oldvec(1) newvec(1)], ...
[oldvec(2) newvec(2)], ... [oldvec(2) newvec(2)], ...
[duneevaluate(oldvec) duneevaluate(newvec)], ... [duneevaluate(oldvec) duneevaluate(newvec)], ...
'color', 'r'); 'color', 'r');
newdiff = newvec - oldvec;
printf("Norm of step: %f\n", norm(newdiff)); printf("Norm of step: %f\n", norm(newdiff));
if (i != 1) if (i != 1)
printf("Angle between steps: %f degrees\n", acos( dot(olddiff,newdiff) / (norm(olddiff) * norm(newdiff)) ) / pi * 180); printf("Angle between steps: %f degrees\n", acos( dot(olddiff,newdiff) / (norm(olddiff) * norm(newdiff)) ) / pi * 180);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment