function dim = dimVVbar(varargin)
% [ V ] = dimVVbar( Om, [k], [options] );
% Computes the dimension of the spaces V_k and \bar{V}_k, as described in Charina, Mejstrik, 2018.
%
% Input: 
%   Om          The set for which Vbar_k shall be constructed as an array of column vectors
%   k           index k, optional. Either an integer or a vector of integers (greater equal zero)
%               If k is empty, then all spaces where dim V_k>0 are computed.
%
% Options:
%   '01'        give input as a 0/1 matrix
%   'verbose'   more text output
%
% Output:
%   dim         first line: dimensions of V_k, for k=0,1,2,3,...
%               second line: dimensions of \bar{V}_k, for k=0,1,2,3,...
%
% E.g.: dimVVbar([1 1 0 0;1 0 1 1;0 1 0 0],'01','verbose',1)
%
% See also: constructV, constructVbar
%
% Written by: tommsch, 2017


dimV=cellfun(@rank,constructV(varargin{:}));
dimVbar=cellfun(@rank,constructVbar(varargin{:}));

verbose=parsem('verbose',varargin);
if(verbose); vdisp(varargin{1}); end;
if(size(dimV,2)>size(dimVbar,2)); dimVbar(size(dimV,2))=0; end;
dim=[dimV;dimVbar];

end
