comparison toolboxes/FullBNT-1.0.7/bnt/potentials/@dpot/dpot.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 pot = dpot(domain, sizes, T)
2 % DPOT Make a discrete (sparse) potential.
3 % pot = dpot(domain, sizes, T, spar)
4 %
5 % sizes(i) is the size of the i'th domain element.
6 % T defaults to all 1s.
7
8 %assert(length(sizes) == length(domain));
9
10 pot.domain = domain(:)'; % so we can see it when we display
11 if nargin < 3
12 pot.T = myones(sizes);
13 %pot.T = ones(1,prod(sizes)); % 1D vector
14 else
15 if isempty(T)
16 pot.T = [];
17 else
18 if issparse(T)
19 pot.T = T;
20 else
21 pot.T = myreshape(T, sizes);
22 end
23 end
24 end
25 pot.sizes = sizes(:)';
26 pot = class(pot, 'dpot');