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