Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x3domlet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
x3domlet
Commits
926361c2
Commit
926361c2
authored
Aug 03, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added weights to least square fitting
parent
181b5dea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
10 deletions
+42
-10
align_functions.js
js/align_functions.js
+17
-3
numbers.calculus.extra.js
js/numbers/numbers.calculus.extra.js
+25
-7
No files found.
js/align_functions.js
View file @
926361c2
...
...
@@ -175,7 +175,21 @@ function hll_dr_dh_i(i,v){
*/
function
hll_w_i
(
i
,
v
){
return
1
;
var
mark
=
Data
.
markers
[
i
];
var
xi
=
mark
.
align
.
x
;
var
yi
=
mark
.
align
.
y
;
var
zi
=
mark
.
align
.
z
;
//var arad = 0.0004404;
var
D
=
100
;
var
d
=
Math
.
sqrt
(
Math
.
pow
(
xi
,
2
)
+
Math
.
pow
(
yi
,
2
)
+
Math
.
pow
(
zi
,
2
));
var
res
=
d
/
D
;
res
=
(
res
>
1
)?
1
:
res
;
return
res
;
}
/**
...
...
@@ -260,8 +274,8 @@ function art_l_i(i){
}
function
art_w_i
(
i
,
v
){
return
1
;
//
return 1/art_l_i(i);
//
return 1;
return
1
/
art_l_i
(
i
);
}
/**
...
...
js/numbers/numbers.calculus.extra.js
View file @
926361c2
...
...
@@ -4,7 +4,7 @@
* @copyright Copyright (C) 2017 Elphel Inc.
* @authors Oleg Dzhimiev <oleg@elphel.com>
*
* @license: GPL-3.0
* @license: GPL-3.0
+
*
* @licstart The following is the entire license notice for the
* JavaScript code in this page.
...
...
@@ -53,6 +53,13 @@ numbers.calculus.GaussNewton = function(v,n,r,dr,eps,w){
};
}
// for normalization
var
WSUM
=
0
;
for
(
var
i
=
0
;
i
<
n
;
i
++
){
WSUM
+=
w
(
i
,
v
)
}
while
(
!
stop
){
counter
++
...
...
@@ -84,8 +91,13 @@ numbers.calculus.GaussNewton = function(v,n,r,dr,eps,w){
var
J
=
jacobian
(
v
,
n
,
dr
)
var
Jt
=
numbers
.
matrix
.
transpose
(
J
)
for
(
var
i
=
0
;
i
<
n
;
i
++
){
J
=
numbers
.
matrix
.
rowScale
(
J
,
i
,
wn
(
i
,
v
))
}
// JtJ
J
=
numbers
.
matrix
.
multiply
(
Jt
,
J
)
// (Jt x J)^-1
J
=
numbers
.
matrix
.
inverse
(
J
)
// (Jt x J)^-1 x Jt
...
...
@@ -93,7 +105,7 @@ numbers.calculus.GaussNewton = function(v,n,r,dr,eps,w){
var
V
=
[]
for
(
var
i
=
0
;
i
<
n
;
i
++
){
V
.
push
([
r
(
i
,
v
)])
V
.
push
([
wn
(
i
,
v
)
*
r
(
i
,
v
)])
}
var
delta
=
numbers
.
matrix
.
multiply
(
J
,
V
)
...
...
@@ -114,16 +126,17 @@ numbers.calculus.GaussNewton = function(v,n,r,dr,eps,w){
function
sigma
(
v
,
n
,
r
){
var
sum
=
0
var
wsum
=
0
//
var wsum = 0
for
(
var
i
=
0
;
i
<
n
;
i
++
){
sum
+=
w
(
i
,
v
)
*
r
(
i
,
v
)
*
r
(
i
,
v
)
wsum
+=
w
(
i
,
v
)
sum
+=
w
n
(
i
,
v
)
*
r
(
i
,
v
)
*
r
(
i
,
v
)
//
wsum += w(i,v)
}
//console.log("sum = "+sum+" wsum = "+wsum);
sum
=
Math
.
sqrt
(
sum
/
wsum
)
//sum = Math.sqrt(sum/wsum)
sum
=
Math
.
sqrt
(
sum
)
return
sum
...
...
@@ -137,7 +150,7 @@ numbers.calculus.GaussNewton = function(v,n,r,dr,eps,w){
var
row
=
[]
for
(
var
j
=
0
;
j
<
dr
.
length
;
j
++
){
row
.
push
(
w
(
i
,
v
)
*
dr
[
j
](
i
,
v
))
row
.
push
(
dr
[
j
](
i
,
v
))
}
J
[
i
]
=
row
...
...
@@ -147,4 +160,9 @@ numbers.calculus.GaussNewton = function(v,n,r,dr,eps,w){
}
// normalized weight
function
wn
(
i
,
v
){
return
w
(
i
,
v
)
/
WSUM
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment