np_calc_jacobian

PURPOSE ^

NP_CALC_JACOBIAN: J= np_calc_jacobian( fwd_model, img)

SYNOPSIS ^

function J= np_calc_jacobian( fwd_model, img)

DESCRIPTION ^

 NP_CALC_JACOBIAN: J= np_calc_jacobian( fwd_model, img)
 Fwd solver for Nick Polydorides EIDORS3D code
 J         = Jacobian matrix
 fwd_model = forward model
 img = image background for jacobian calc

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function J= np_calc_jacobian( fwd_model, img)
0002 % NP_CALC_JACOBIAN: J= np_calc_jacobian( fwd_model, img)
0003 % Fwd solver for Nick Polydorides EIDORS3D code
0004 % J         = Jacobian matrix
0005 % fwd_model = forward model
0006 % img = image background for jacobian calc
0007 
0008 % (C) 2005 Andy Adler. License: GPL version 2 or version 3
0009 % $Id: np_calc_jacobian.m 5395 2017-04-12 16:00:13Z aadler $
0010 
0011 warning('EIDORS:deprecated','NP_CALC_JACOBIAN is deprecated as of 07-Jun-2012. Use CALC_JACOBIAN_ADJOINT instead.');
0012 
0013 if nargin==1 % normal way to call
0014    img = fwd_model;
0015    fwd_model = img.fwd_model;
0016 else
0017    img.fwd_model = fwd_model; %force use of supplied fwd_model
0018 end
0019 
0020 p= np_fwd_parameters( fwd_model );
0021 
0022 s_mat= calc_system_mat( img );
0023 
0024 v_f = np_calc_3d_fields( img );
0025 
0026 tol = 1e-5; %tolerance for the forward solver
0027 
0028 % Calculating the Jacobian
0029 Vfwd = forward_solver(s_mat.E, p.I, tol, s_mat.perm);
0030 
0031 if isfield(fwd_model,'coarse2fine');
0032    J = jacobian_3d_fields(Vfwd,s_mat.Ela,s_mat.D, p.elec, ...
0033                           p.vtx,p.simp, img.elem_data, v_f, p.df, ...
0034                           fwd_model.coarse2fine);
0035    nparam= size(fwd_model.coarse2fine,2);
0036 else 
0037    J = jacobian_3d_fields(Vfwd,s_mat.Ela,s_mat.D, p.elec, ...
0038                           p.vtx,p.simp, img.elem_data, v_f, p.df);
0039    nparam= p.n_elem;
0040 end
0041 
0042 % calculate normalized Jacobian if required
0043 if p.normalize
0044    data= fwd_solve( img );
0045    J= J ./ (data.meas(:)*ones(1,nparam));
0046 end
0047

Generated on Tue 31-Dec-2019 17:03:26 by m2html © 2005