Skip to content

Commit 59dca64

Browse files
committed
wider use
1 parent 7f0070c commit 59dca64

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

+stdlib/checkRAM.m

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
%% CHECKRAM estimate if RAM will fit a new array
22
% checks that requested memory for the new array won't exceed AVAILABLE RAM with Matlab
33
%
4+
%%% Inputs
5+
% * newSize: vector of array per-dimension lengths
6+
% * myclass: name of class
7+
%%% Outputs
8+
% * OK: logical if array is predicted to fit in RAM
9+
% * newSizeBytes: estimated array memory usage
10+
% * freebytes: current free RAM (before allocating array)
11+
%
412
% This script is optimistic as Matlab won't always be able to
513
% create an array using ALL available RAM, but at least you know when you
614
% certainly CAN'T create an array without digging deep into swap or worse.
715

16+
817
function [OK,newSizeBytes,freebytes] = checkRAM(newSize, myclass)
9-
arguments
10-
newSize (1,:) {mustBeNumeric}
11-
myclass
12-
end
1318

1419
% get available RAM
1520
freebytes = stdlib.ram_free();

+stdlib/get_uid.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
% * b: backend used
88

99
function [i, b] = get_uid(backend)
10-
arguments
11-
backend (1,:) string = ["dotnet", "python", "perl"]
10+
if nargin < 1
11+
backend = ["dotnet", "python", "perl"];
12+
else
13+
backend = string(backend);
1214
end
1315

1416
i = [];

0 commit comments

Comments
 (0)