Changeset 1040 for applications/bdmtoolbox/mex
- Timestamp:
- 06/04/10 14:26:02 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/bdmtoolbox/mex/mex_classes/mexEpdf.m
r1037 r1040 1 %> @file mexEpdf.m 2 %> @brief File mappring root class of epdf from BDM 3 % ====================================================================== 4 %> @brief Abstract class of unconditional probability density function (epdf) 5 % 6 %> This class provides a bridge between bdm::epdf and Matlab 7 % ====================================================================== 1 8 classdef mexEpdf 2 9 properties 3 rv=RV; %empty description add some valid RV when needed 10 %> Description of random variable (see definitiopn of RV) 11 rv=RV; 4 12 end 5 13 methods 14 %> Function returning mean value of this epdf 6 15 function m=mean(p) 7 16 error('define how to compute mean') 8 17 end 18 %> This function is called before using the object. It should check consistency of the properties and fill default values. 9 19 function validate(p) 10 20 error('check if the density is consistent') 11 21 end 22 %> Tell the world around it dimension of the random variable 12 23 function dim=dimension(p) 13 24 error('return dimension of the density') 14 25 end 26 %> Function returning variance of this epdf 15 27 function v=variance(p) 16 28 error('define how to compute mean') 17 29 end 30 %> Function returning logarithm of likelihood function in point x 18 31 function l=evallog(p,x) 19 32 error('define how to evaluate log of this density at point x') 20 33 end 34 %> Function returning a signle sample from this density 21 35 function l=sample(p) 22 36 error('define how to sample from this density') … … 25 39 %%% default functions -- no need to redefine %%% 26 40 41 %> Function returning logarithm of NON-normalized likelihood function in point x (speed optimization) 27 42 function l=evallog_nn(p,x) 28 43 % define how to evaluate non-normalized log of this density at point x … … 30 45 l=evallog(p,x); 31 46 end 47 32 48 function r=get_rv(p) 33 49 r=p.rv; 34 50 end 51 %> Function returning a matrix of n samples from this density, 35 52 function m = samplemat(obj, n) 36 53 m = zeros(obj.dimension, n);