-
Notifications
You must be signed in to change notification settings - Fork 5
/
falconMulti.m
60 lines (53 loc) · 1.71 KB
/
falconMulti.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
function [v_sol, corrval, nvar, v_all, fTime, fIter, ...
v_sol_s, corrval_s, nvar_s, fTime_s, fIter_s] = ...
falconMulti(m, nReps, varargin)
% Brandon Barker 2014
%
% This is like falcon, but returns a mean for v_sol, corrval,
% nvar, fTime, and fIter.
% v_all is not intended to be used in this script,
% so it is returned as [].
%
%INPUT same as falcon.m, and also:
%
% nReps the number of replicate falcon fits.
%
%OUTPUT same as falcom.m, and also:
%
% v_sol_s, corrval_s, nvar_s, fTime_s, fIter_s
% (these are the standard deviations of their namesakes)
%
% fileNameOut (falcon_nReps_StartTime.mat): distribution data for
%
nRxns = length(m.rxns);
v_sol_Dist = zeros(nReps, nRxns);
corrval_Dist = zeros(nReps, 1);
nvar_Dist = zeros(nReps, 1);
fTime_Dist = zeros(nReps, 1);
fIter_Dist = zeros(nReps, 1);
v_all = [];
timeInit = num2str(now());
parfor i = 1:nReps
[v_sol, corrval, nvar, ~, fTime, fIter] = ...
falcon(m, varargin{:});
v_sol_Dist(i, :) = columnVector(v_sol)';
corrval_Dist(i) = corrval;
fTime_Dist(i) = fTime;
fIter_Dist(i) = fIter;
end
v_sol = mean(v_sol_Dist)';
nvar = mean(nvar_Dist);
corrval = mean(corrval_Dist);
fTime = mean(fTime_Dist);
fIter = mean(fIter_Dist);
v_sol_s = std(v_sol_Dist)';
nvar_s = std(nvar_Dist);
corrval_s = std(corrval_Dist);
fTime_s = std(fTime_Dist);
fIter_s = std(fIter_Dist);
fileNameOut = ['falcon_' num2str(nReps) '_' timeInit '.mat'];
save(fileNameOut, 'v_sol', 'v_sol_s', 'v_sol_Dist', ...
'corrval', 'corrval_s', 'corrval_Dist', ...
'nvar', 'nvar_s', 'nvar_Dist', ...
'fTime', 'fTime_s', 'fTime_Dist', ...
'fIter', 'fIter_s', 'fIter_Dist');