num_nodes

PURPOSE ^

NUM_NODES: number of elemnts in a (fwd or inv model or image)

SYNOPSIS ^

function num = num_nodes( mdl );

DESCRIPTION ^

 NUM_NODES: number of elemnts in a (fwd or inv model or image)
 n_nodes = num_nodes( mdl );

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function num = num_nodes( mdl );
0002 % NUM_NODES: number of elemnts in a (fwd or inv model or image)
0003 % n_nodes = num_nodes( mdl );
0004 
0005 % $Id: num_nodes.m 5112 2015-06-14 13:00:41Z aadler $
0006 
0007 if ischar(mdl) && strcmp(mdl,'UNIT_TEST'); do_unit_test; return; end
0008 
0009 switch mdl.type
0010   case 'image';      fmdl = mdl.fwd_model;
0011   case 'inv_model';  fmdl = mdl.fwd_model;
0012   case 'fwd_model';  fmdl = mdl;
0013   otherwise;
0014       error('can''t process model of type %s', mdl.type );
0015 end
0016 
0017 num = size(fmdl.nodes,1);
0018 
0019 function do_unit_test
0020    mdl = mk_common_model('a2c2',8);
0021    ne = num_nodes( mdl );
0022    unit_test_cmp('test1',ne,41);
0023 
0024    ne = num_nodes( mdl.fwd_model );
0025    unit_test_cmp('test2',ne,41);
0026 
0027    ne = num_nodes( mk_image( mdl ));
0028    unit_test_cmp('test3',ne,41);
0029 
0030    mdl = mk_common_model('n3r2',[16,2]);
0031    ne = num_nodes( mk_image( mdl ));
0032    unit_test_cmp('test4',ne,252);

Generated on Fri 30-Dec-2022 19:44:54 by m2html © 2005