-
Notifications
You must be signed in to change notification settings - Fork 3
/
memsize.m
41 lines (37 loc) · 988 Bytes
/
memsize.m
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function memsize(varargin)
%% Estimate the Minimum Memory Size
% memsize(d) displays the memory size of the Hamiltonian and the Lindblad
% superoperator given the Hilbert dimension d. d can be specified as an integer
% vector, in which case the Hilbert dimension is taken as the product of the
% elements in d.
%
% memsize(obj1,obj2,...) obtains the Hilbert dimension(s) from the property of
% obj1, obj2, ...
%
% Requires package:
% - MatCommon_v1.0.0+
%
% Tested on:
% - MATLAB R2015b
% - MATLAB R2017a
%
% See also: Interaction, Lindblad.
%
% Copyright: Herianto Lim (http://heriantolim.com)
% Licensing: GNU General Public License v3.0
% First created: 19/06/2017
% Last modified: 19/06/2017
if nargin==0
return
end
if isintegervector(varargin{1})
M=prod(varargin{1})^2;
else
M=prod(Hilbert.dimension(varargin{:}))^2;
end
M(2)=M(1)^2;
M=M*16;
fprintf('Memory size for:\n');
fprintf(' Hamiltonian : %g bytes\n',M(1));
fprintf(' Lindblad : %g bytes\n',M(2));
end