repo.or.cz
/
wrf-fire-matlab.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
compare_fire_area.m also diffs ros
[wrf-fire-matlab.git]
/
quicwind
/
adj_test.m
blob
68b1116565c5bdd61b84ea309201bf642c716ef0
1
function err=adj_test
2
disp('adj_test')
3
disp('testing if grad3z and div3 are adjoint')
4
h=rand(1,3);
5
n=[20,7,2];
6
lambda = rand(n);
7
g = grad3z(lambda,h);
8
for i=1:length(g)
9
u{i}=rand(size(g{i}));
10
end
11
div3u = div3(u,h);
12
l3z = grad3z(lambda,h);
13
err = aprod(lambda,div3u) + aprod3(l3z,u)
14
end
15
16
function a=aprod(x,y)
17
a = dot(x(:),y(:));
18
end
19
20
function a=aprod3(x,y)
21
a = aprod(x{1},y{1})+aprod(x{2},y{2})+aprod(x{3},y{3});
22
end