Commit 05489e74 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

debug

parent 1494df60
...@@ -59,7 +59,7 @@ numbers.calculus.GaussNewton = function(v,n,r,dr,eps,w){ ...@@ -59,7 +59,7 @@ numbers.calculus.GaussNewton = function(v,n,r,dr,eps,w){
var v1 = iterate(v0,n,r,dr) var v1 = iterate(v0,n,r,dr)
//console.log(v1); console.log(v1);
var s0 = sigma(v0,n,r) var s0 = sigma(v0,n,r)
var s1 = sigma(v1,n,r) var s1 = sigma(v1,n,r)
...@@ -85,8 +85,6 @@ numbers.calculus.GaussNewton = function(v,n,r,dr,eps,w){ ...@@ -85,8 +85,6 @@ numbers.calculus.GaussNewton = function(v,n,r,dr,eps,w){
var J = jacobian(v,n,dr) var J = jacobian(v,n,dr)
console.log(J);
var Jt = numbers.matrix.transpose(J) var Jt = numbers.matrix.transpose(J)
for(var i=0;i<n;i++){ for(var i=0;i<n;i++){
...@@ -197,6 +195,8 @@ numbers.calculus.GaussNewton_nD = function(v,n,r,dr,eps,w){ ...@@ -197,6 +195,8 @@ numbers.calculus.GaussNewton_nD = function(v,n,r,dr,eps,w){
var counter = 0 var counter = 0
var v0 = v var v0 = v
var xn = r.length;
if (w===undefined){ if (w===undefined){
w = function(){ w = function(){
return 1; return 1;
...@@ -231,7 +231,11 @@ numbers.calculus.GaussNewton_nD = function(v,n,r,dr,eps,w){ ...@@ -231,7 +231,11 @@ numbers.calculus.GaussNewton_nD = function(v,n,r,dr,eps,w){
//functions //functions
function iterate(v,n,r,dr){ function iterate(v,n,r,dr){
var wsum = ws(v,n) var wsum = 0;
for(var j=0;j<xn;j++){
wsum += ws(v,n,xn)
}
var J = jacobian(v,n,dr) var J = jacobian(v,n,dr)
var Jt = numbers.matrix.transpose(J) var Jt = numbers.matrix.transpose(J)
...@@ -307,19 +311,19 @@ numbers.calculus.GaussNewton_nD = function(v,n,r,dr,eps,w){ ...@@ -307,19 +311,19 @@ numbers.calculus.GaussNewton_nD = function(v,n,r,dr,eps,w){
} }
// normalized weight // normalized weight
function wn(i,v,wsum){ function wn(i,v,wsum,xn){
return w(i,v)/wsum return w[xn](i,v)/wsum
} }
// sum of weights for normalization // sum of weights for normalization
function ws(v,n){ function ws(v,n,xn){
var wsum = 0 var wsum = 0
for(var i=0;i<n;i++){ for(var i=0;i<n;i++){
wsum += w(i,v) wsum += w[xn](i,v)
} }
return wsum return wsum
......
...@@ -401,7 +401,18 @@ function x3dom_align_hll3(){ ...@@ -401,7 +401,18 @@ function x3dom_align_hll3(){
var xyh = [x0,y0]; var xyh = [x0,y0];
var result = numbers.calculus.GaussNewton(xyh,Data.markers.length,hll3_r_i,[hll3_dr_dx_i,hll3_dr_dy_i],epsilon,hll3_w_i); var result = numbers.calculus.GaussNewton(xyh,Data.markers.length,hll3_r_i,[hll3_dr_dx_i,hll3_dr_dy_i],epsilon,hll3_w_i);
//var result = numbers.calculus.GaussNewton_nD(xyh,Data.markers.length,hll3_r_i,[hll3_dr_dx_i,hll3_dr_dy_i],epsilon,hll3_w_i);
/*
var rs_i = [hll3_r_i, hll3_r_i];
var drs_i = [
[hll3_dr_dx_i, hll3_dr_dy_i],
[hll3_dr_dx_i, hll3_dr_dy_i]
];
var ws_i = [hll3_w_i, hll3_w_i];
var result = numbers.calculus.GaussNewton_nD(xyh,Data.markers.length,rs_i,drs_i,epsilon,ws_i);
*/
xyh = [result.v[0],result.v[1],h0]; xyh = [result.v[0],result.v[1],h0];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment