comparison toolboxes/FullBNT-1.0.7/bnt/potentials/@dpot/dpot.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:cc4b1211e677
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');