Changeset 944 for applications/bdmtoolbox/mex
- Timestamp:
- 05/16/10 23:13:21 (14 years ago)
- Location:
- applications/bdmtoolbox/mex
- Files:
-
- 2 added
- 1 removed
- 6 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/bdmtoolbox/mex/RV.m
r937 r944 3 3 4 4 if nargin<1 5 names= '';5 names={}; 6 6 end 7 7 r.class='RV'; -
applications/bdmtoolbox/mex/class_defaults.cpp
r797 r944 17 17 #include <mex/mex_parser.h> 18 18 #include <mex/mex_function.h> 19 #include <mex/mex_BM.h> 19 20 20 21 void mexFunction ( int n_output, mxArray *output[], int n_input, const mxArray *input[] ) { … … 25 26 "output:\n" 26 27 " the same structure filled with the defaults.\n\n" 27 "This operation is usefull for obtaining info about a class construction" );28 "This operation is usefull for obtaining info about class defaults, or success of passing info to it" ); 28 29 29 30 RV::clear_all(); -
applications/bdmtoolbox/mex/estimator.cpp
r863 r944 89 89 if ( n_input>3 ) { 90 90 Cfg.addGroup ( input[3],"logger" ); 91 }/*else{ 92 // define logger as mexlog 93 Setting &S=Cfg.getRoot(); 94 S.add("logger",Setting::TypeGroup); 95 S["logger"].add("class",Setting::TypeString); 96 S["logger"]["class"]="mexlog"; 97 S["logger"].add("maxlen",Setting::TypeInt); 98 int maxlen; 99 S["experiment"].lookupValue("ndat",maxlen); 100 S["logger"]["maxlen"]=maxlen; 101 }*/ 91 } 102 92 } catch ( SettingException e ) { 103 93 it_error ( "error: "+string ( e.getPath() ) ); -
applications/bdmtoolbox/mex/mex_classes/mexBM.m
r943 r944 1 1 classdef mexBM 2 2 properties 3 % from wikipedia 4 rv 5 rvc 6 rvy 3 % description of internal variables 4 rv=RV 5 rvc=RV 6 rvy=RV 7 % log of evidence (marginal likelihood) potentially computed by the 8 % bayes rule for one step 9 log_evidence 10 % posterior density - offspring of mexEpdf! 11 apost_pdf 12 % 7 13 end 14 8 15 methods 9 function validate(p)10 16 function p=validate(p) 17 % checks if all paramateres match 11 18 end 12 19 function dims=dimensions(p) … … 21 28 % return posterior density 22 29 end 30 31 %%%%%%%% default functions %%%%%%%%%%%%%% 32 function r = get_rv(obj) 33 r=obj.rv; 34 end 35 function r = get_rvc(obj) 36 r=obj.rvc; 37 end 38 function r = get_rvy(obj) 39 r=obj.rvy; 40 end 41 function ev = logevidence(obj) 42 ev = obj.log_evidence; 43 end 44 function post=posterior(obj); 45 post = obj.apost_pdf; 46 end 23 47 end 24 48 end -
applications/bdmtoolbox/mex/mex_classes/mexEpdf.m
r943 r944 20 20 end 21 21 22 %%% default function %%%22 %%% default functions -- no need to redefine %%% 23 23 24 24 function l=evallog_nn(p,x) -
applications/bdmtoolbox/mex/mex_classes/mexLaplace.m
r937 r944 6 6 end 7 7 methods 8 function m=mean( p)9 m = p.mu;8 function m=mean(obj) 9 m = obj.mu; 10 10 end 11 function validate(p)12 if size(p.mu)<1 & (size(p.b)<1)11 function obj=validate(obj) 12 if length(obj.mu)~=length(obj.b) 13 13 error('incompatible mu and b'); 14 14 end 15 15 end 16 function dim=dimension( p)17 dim = size( p.mu,1);16 function dim=dimension(obj) 17 dim = size(obj.mu,1); 18 18 end 19 function v=variance( p)20 v=2* p.b^2;19 function v=variance(obj) 20 v=2*obj.b^2; 21 21 end 22 function l=evallog( p,x)23 l=-log(2* p.b)-abs(x-p.mu)/p.b;22 function l=evallog(obj,x) 23 l=-log(2*obj.b)-abs(x-obj.mu)/obj.b; 24 24 end 25 function s=sample( p);25 function s=sample(obj) 26 26 v=-log(rand);%sample_exponential(0,1); 27 27 z = randn; 28 s = p.mu+p.b*sqrt(2*v)*z;28 s = obj.mu+obj.b*sqrt(2*v)*z; 29 29 end 30 30 end