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
cp readslice.R ts_readslice.R
[wrf-fire-matlab.git]
/
quicwind
/
fun2mat_sym.m
blob
030e0a650bb13e1798f448af872397efce27da1e
1
function a=fun2mat_sym(fun,n)
2
% return matrix a such that a*u(:) = (fun(u))(:) for 3d u size n
3
u = zeros(n);
4
outn = size(fun(u));% size of output
5
a = sparse([],[],[],prod(outn),prod(n),5*prod(n));
6
k=0;
7
for i3=1:n(3)
8
for i2=1:n(2)
9
for i1=1:n(1)
10
u(i1,i2,i3)=1;
11
k=k+1;
12
out = fun(u);
13
a(:,k)=out(:);
14
u(i1,i2,i3)=0;
15
end
16
end
17
end
18