Mercurial > hg > camir-aes2014
diff toolboxes/FullBNT-1.0.7/bnt/potentials/@cgpot/cgpot.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolboxes/FullBNT-1.0.7/bnt/potentials/@cgpot/cgpot.m Tue Feb 10 15:05:51 2015 +0000 @@ -0,0 +1,38 @@ +function pot = cgpot(ddom, cdom, node_sizes, can, mom, subtype) +% CPOT Make a canonical CG potential. +% function pot = cgpot(ddom, cdom, node_sizes, can, mom, subtype) +% +% node_sizes(i) is the size of the i'th node. +% can and mom default to 0s. +% subtype defaults to 'c'. + +if nargin < 6, subtype = 'c'; end + +pot.ddom = ddom; +pot.cdom = cdom; +node_sizes = node_sizes(:)'; % row vectors print better +pot.domain = myunion(ddom, cdom); +pot.dsizes = node_sizes(pot.ddom); +pot.dsize = prod(node_sizes(pot.ddom)); +pot.csizes = node_sizes(pot.cdom); +pot.csize = sum(node_sizes(pot.cdom)); +pot.subtype = subtype; + +if nargin < 4 + can = cell(1, pot.dsize); + for i=1:pot.dsize + can{i} = cpot(cdom, node_sizes(cdom)); + end +end +pot.can = can; + +if nargin < 5 + mom = cell(1, pot.dsize); + for i=1:pot.dsize + mom{i} = mpot(cdom, node_sizes(cdom)); + end +end +pot.mom = mom; + +pot = class(pot, 'cgpot'); +