about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/BNT/potentials/@dpot/dpot.m
blob: 74b5dd9ec5e918ca72e5c6b9b99544d9279e54d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function pot = dpot(domain, sizes, T)
% DPOT Make a discrete (sparse) potential.
% pot = dpot(domain, sizes, T, spar)
%
% sizes(i) is the size of the i'th domain element.
% T defaults to all 1s.

%assert(length(sizes) == length(domain));

pot.domain = domain(:)'; % so we can see it when we display
if nargin < 3
  pot.T = myones(sizes);
  %pot.T = ones(1,prod(sizes)); % 1D vector
else 
   if isempty(T)
      pot.T = [];
   else
      if issparse(T)
         pot.T = T;   
      else
         pot.T = myreshape(T, sizes);  
      end
   end
end
pot.sizes = sizes(:)';
pot = class(pot, 'dpot');