- Timestamp:
- 06/21/20 21:48:26 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/qmu/histogram_bin_uncertain.m
r25078 r25090 1 % % definition for the histogram_bin_uncertain class.1 %HISTOGRAM BIN UNCERTAIN class definition 2 2 % 3 % 3 % [hbu]=histogram_bin_uncertain(varargin) 4 4 % 5 % 6 % descriptor(char, description, '')7 % pairs_per_variable(double vector, [])8 % abscissas(double vector, [])9 % counts(int vector, [])5 % where the required varargin are: 6 % descriptor (char, description, '') 7 % pairs_per_variable (double vector, []) 8 % abscissas (double vector, []) 9 % counts (int vector, []) 10 10 % 11 % note that zero arguments constructs a default instance; one12 % argument of the class copies the instance; and three or more13 % 11 % NOTE: A call to the constructor with zero arguments will return a default 12 % instance; one argument of the class copies the instance; three or more 13 % arguments constructs a new instance from the arguments. 14 14 % 15 15 classdef histogram_bin_uncertain 16 17 16 properties 17 descriptor=''; 18 18 pairs_per_variable=[]; 19 abscissas = []; 20 counts = []; 21 end 22 23 methods 24 function [hbu]=histogram_bin_uncertain(varargin) % {{{ 25 26 switch nargin 27 case 0 % create a default object 28 case 1 % copy the object 29 if isa(varargin{1},'histogram_bin_uncertain') 30 hbu=varargin{1}; 31 else 32 error('Object ''%s'' is a ''%s'' class object, not ''%s''.',... 33 inputname(1),class(varargin{1}),'histogram_bin_uncertain'); 34 end 35 case {2,3} % not enough arguments 36 error('Construction of ''%s'' class object requires at least %d inputs.',... 37 'histogram_bin_uncertain',4) 38 case 4 % 19 abscissas = []; 20 counts = []; 21 end 22 methods 23 function [hbu]=histogram_bin_uncertain(varargin) % {{{ 24 switch nargin 25 case 0 % create a default object 26 case 1 % copy the object 27 if isa(varargin{1},'histogram_bin_uncertain') 28 hbu=varargin{1}; 29 else 30 error('Object ''%s'' is a ''%s'' class object, not ''%s''.',... 31 inputname(1),class(varargin{1}),'histogram_bin_uncertain'); 32 end 33 case {2,3} % not enough arguments 34 error('Construction of ''histogram_bin_uncertain'' class object requires at least %d inputs.',4) 35 case 4 % 39 36 % create the object from the input 40 37 hbu = histogram_bin_uncertain; … … 44 41 hbu.counts=varargin{4}; 45 42 46 otherwise 47 error('Construction of histogram_bin_uncertain class object requires three arguments, descriptor, abscissas and counts'); 48 end 49 50 end % }}} 43 otherwise 44 error('Construction of histogram_bin_uncertain class object requires either (1) no arguments, (2) a histogram_bin_uncertain instance to copy from, or (3) a descriptor and pairs per variable, abscissas, and counts lists'); 45 end 46 end % }}} 51 47 function md=checkconsistency(self,md,solution,analyses) % {{{ 52 48 end % }}} 53 function []=disp(hbu) % {{{ 54 55 % display the object 56 57 disp(sprintf('\n')); 58 for i=1:numel(hbu) 49 function []=disp(hbu) % {{{ 50 % display the object 51 disp(sprintf('\n')); 52 for i=1:numel(hbu) 59 53 disp(sprintf('class ''%s'' object ''%s%s'' = \n',... 60 54 class(hbu),inputname(1),string_dim(hbu,i))); … … 64 58 disp(sprintf(' counts: %g' ,hbu(i).counts)); 65 59 end 66 67 60 end % }}} 68 function [desc] 61 function [desc]=prop_desc(hbu,dstr) % {{{ 69 62 desc=cell(1,numel(hbu)); 70 63 for i=1:numel(hbu) … … 84 77 initpt=[]; 85 78 end % }}} 86 function [lower] 79 function [lower]=prop_lower(hbu) % {{{ 87 80 lower=[]; 88 81 end % }}} 89 function [upper] 82 function [upper]=prop_upper(hbu) % {{{ 90 83 upper=[]; 91 84 end % }}} 92 function [mean] 85 function [mean]=prop_mean(hbu) % {{{ 93 86 mean=[]; 94 87 end % }}} … … 99 92 initst=[]; 100 93 end % }}} 101 function [stype] 94 function [stype]=prop_stype(hbu) % {{{ 102 95 stype={}; 103 96 end % }}} 104 function [scale] 97 function [scale]=prop_scale(hbu) % {{{ 105 98 scale=[]; 106 99 end % }}} 107 function [abscissas] =prop_abscissas(hbu) % {{{ 108 abscissas=[]; 109 for i=1:numel(hbu) 110 abscissas=[abscissas hbu(i).abscissas]; 111 end 112 abscissas=allequal(abscissas,-Inf); 113 114 end % }}} 100 function [abscissas]=prop_abscissas(hbu) % {{{ 101 abscissas=[]; 102 for i=1:numel(hbu) 103 abscissas=[abscissas hbu(i).abscissas]; 104 end 105 abscissas=allequal(abscissas,-Inf); 106 end % }}} 115 107 function [pairs_per_variable] =prop_pairs_per_variable(hbu) % {{{ 116 108 pairs_per_variable=zeros(1,numel(hbu)); … … 121 113 end % }}} 122 114 function [counts] =prop_counts(hbu) % {{{ 123 counts=[]; 124 for i=1:numel(hbu) 125 counts=[counts hbu(i).counts]; 126 end 127 counts=allequal(counts,-Inf); 128 115 counts=[]; 116 for i=1:numel(hbu) 117 counts=[counts hbu(i).counts]; 118 end 119 counts=allequal(counts,-Inf); 129 120 end % }}} 130 121 function scaled=isscaled(self) % {{{ … … 138 129 methods (Static) 139 130 function []=dakota_write(fidi,dvar) % {{{ 131 % collect only the variables of the appropriate class 132 hbu=struc_class(dvar,'histogram_bin_uncertain'); 140 133 141 % collect only the variables of the appropriate class 142 143 hbu=struc_class(dvar,'histogram_bin_uncertain'); 144 145 % write variables 146 134 % write variables 147 135 vlist_write(fidi,'histogram_bin_uncertain','hbu',hbu); 148 136 end % }}}
Note:
See TracChangeset
for help on using the changeset viewer.