RtR_PRIOR_ELEM2NODES: Convert elem to nodal RtR Image Prior Reg= RtR_prior_elem2nodes( inv_model) Reg => output regularization term inv_model => inverse model struct Parameters: inv_model.RtR_prior_elem2nodes.RtR_prior= func which calcs prior inv_model.RtR_prior_elem2nodes.fwd_model= fwd model for elem2nodes
0001 function Reg= RtR_prior_elem2nodes( inv_model ) 0002 % RtR_PRIOR_ELEM2NODES: Convert elem to nodal RtR Image Prior 0003 % Reg= RtR_prior_elem2nodes( inv_model) 0004 % Reg => output regularization term 0005 % inv_model => inverse model struct 0006 % Parameters: 0007 % inv_model.RtR_prior_elem2nodes.RtR_prior= func which calcs prior 0008 % inv_model.RtR_prior_elem2nodes.fwd_model= fwd model for elem2nodes 0009 0010 % (C) 2008 Andy Adler. License: GPL version 2 or version 3 0011 % $Id: RtR_prior_elem2nodes.m 3040 2012-06-06 15:20:40Z aadler $ 0012 0013 NtoE = mapper_nodes_elems( inv_model.RtR_prior_elem2nodes.fwd_model ); 0014 0015 Reg_e= feval(inv_model.RtR_prior_elem2nodes.RtR_prior, inv_model); 0016 Reg= NtoE*Reg_e*NtoE'; 0017 0018 nn= size(NtoE,1); 0019 % Sometimes NtoE is singular. We use a cheap test here, because it 0020 % is a structured matrix, and we don't want to use cond or condest 0021 % Use a NOSER type prior, because its not quite clear how to 0022 % regularize in this case. 0023 singular = det(NtoE(:,1:nn))<1e-13; 0024 if singular 0025 hp = 1e-6; 0026 dReg= hp*spdiags(Reg,0); 0027 Reg= Reg + spdiags(dReg,0,nn,nn); 0028 end