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