Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/bnt/CPDs/@tabular_kernel/tabular_kernel.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 function K = tabular_kernel(sz, table) | |
2 % TABULAR_KERNEL Make a table-based local kernel (discrete potential) | |
3 % K = tabular_kernel(sz, table) | |
4 % | |
5 % sz(i) is the number of values the i'th member of this kernel can have | |
6 % table is an optional array of size sz[1] x sz[2] x... [default: random] | |
7 | |
8 if nargin==0 | |
9 % This occurs if we are trying to load an object from a file. | |
10 K = init_fields; | |
11 K = class(K, 'tabular_kernel'); | |
12 return; | |
13 elseif isa(sz, 'tabular_kernel') | |
14 % This might occur if we are copying an object. | |
15 K = sz; | |
16 return; | |
17 end | |
18 K = init_fields; | |
19 | |
20 if nargin < 2, table = myrand(sz); end | |
21 | |
22 K.sz = sz; | |
23 K.table = table; | |
24 | |
25 K = class(K, 'tabular_kernel'); | |
26 | |
27 | |
28 %%%%%%% | |
29 | |
30 | |
31 function K = init_fields() | |
32 % This ensures we define the fields in the same order | |
33 % no matter whether we load an object from a file, | |
34 % or create it from scratch. (Matlab requires this.) | |
35 | |
36 K.sz = []; | |
37 K.table = []; | |
38 | |
39 | |
40 |