-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakeDsMatrix.m
More file actions
executable file
·39 lines (28 loc) · 945 Bytes
/
Copy pathmakeDsMatrix.m
File metadata and controls
executable file
·39 lines (28 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function dsMatrix = makeDsMatrix( A, phi, x, y )
Nx = numel(x);
Ny = numel(y);
nA = numel(A);
nPhi = numel(phi);
nNonzero = Ny * nA * nPhi;
colIndxs = zeros( nNonzero, 1 );
rowIndxs = zeros( nNonzero, 1 );
values = zeros( nNonzero, 1 );
rowImg = (1:Ny)' * ones(1,Nx);
colImg = ones(Ny,1) * (1:Nx);
for i=1:nA*nPhi
if mod(i,100)==0
disp(['dsMatrix ', num2str(i), ' of ', num2str(nA*nPhi)]);
end
dsIn = zeros(nA,nPhi);
dsIn(i) = 1;
dsOut = dsTransform( dsIn, A, phi, x, y );
nonzeroIndxs = find( dsOut ~= 0 );
colIndxs( (i-1)*Ny + 1 : i*Ny ) = i;
rowIndxs( (i-1)*Ny + 1 : i*Ny ) = nonzeroIndxs;
values( (i-1)*Ny + 1 : i*Ny ) = dsOut( nonzeroIndxs );
end
save( 'rowIndxs.mat', 'rowIndxs' );
save( 'colIndxs.mat', 'colIndxs' );
save( 'values.mat', 'values' );
dsMatrix = sparse( rowIndxs, colIndxs, values, Ny*Nx, nA*nPhi );
end