Commit ad4ba4ca authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

testing old functions

parent 05489e74
......@@ -301,6 +301,11 @@ function hll3_w_i(i,v){
}
/**
* Functions for position latitude and longitude (heading is fixed)
* hll3a_...
*/
/**
......
......@@ -40,8 +40,14 @@
*/
numbers.calculus.GaussNewton = function(v,n,r,dr,eps,w){
// divide delta by 2
var D_DIV = 2
console.log("Will divide delta by "+D_DIV)
var epsilon = eps || 1e-8
var limit = 1000
//var limit = 1000
var limit = 50
var stop = false
var counter = 0
......@@ -113,7 +119,7 @@ numbers.calculus.GaussNewton = function(v,n,r,dr,eps,w){
var res = []
for(var i=0;i<v.length;i++){
res[i] = v[i]-delta[i][0]
res[i] = v[i]-delta[i][0]/D_DIV
}
return res
......@@ -231,17 +237,24 @@ numbers.calculus.GaussNewton_nD = function(v,n,r,dr,eps,w){
//functions
function iterate(v,n,r,dr){
var wsum = 0;
var xn = r.length;
var wsum = 0
var J = []
for(var j=0;j<xn;j++){
wsum += ws(v,n,xn)
wsum += ws(v,n,j)
J = J.concat(jacobian(v,n,dr[j]))
}
var J = jacobian(v,n,dr)
console.log(J)
var Jt = numbers.matrix.transpose(J)
for(var j=0;j<xn;j++){
for(var i=0;i<n;i++){
J = numbers.matrix.rowScale(J,i,wn(i,v,wsum))
J = numbers.matrix.rowScale(J,n*j+i,wn(i,v,wsum,j))
}
}
// JtJ
......@@ -254,8 +267,10 @@ numbers.calculus.GaussNewton_nD = function(v,n,r,dr,eps,w){
var V = []
for(var j=0;j<xn;j++){
for(var i=0;i<n;i++){
V.push([wn(i,v,wsum)*r(i,v)])
V.push([wn(i,v,wsum,j)*r[j](i,v)])
}
}
var delta = numbers.matrix.multiply(J,V)
......@@ -275,13 +290,21 @@ numbers.calculus.GaussNewton_nD = function(v,n,r,dr,eps,w){
function sigma(v,n,r){
var xn = r.length;
var sum = 0
var wsum = ws(v,n)
var wsum = 0;
for(var j=0;j<xn;j++){
wsum += ws(v,n,j)
}
for(var j=0;j<xn;j++){
for(var i=0;i<n;i++){
sum += wn(i,v,wsum)*r(i,v)*r(i,v)
sum += wn(i,v,wsum,j)*r[j](i,v)*r[j](i,v)
//wsum += w(i,v)
}
}
//console.log("sum = "+sum+" wsum = "+wsum);
......
......@@ -403,13 +403,13 @@ function x3dom_align_hll3(){
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 rs_i = [hll3_r_i, hll3_r_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 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);
*/
......
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