1function stats = spqr_rank_order_fields ( stats )
2%SPQR_RANK_ORDER_FIELDS orders the fields of stats in a convenient order.
3% Not user-callable.
4% Usage:  stats = sqpr_rank_remove_fields (stats)
5
6% Copyright 2012, Leslie Foster and Timothy A Davis.
7
8% create stats0 which has the desired order for all potential fields
9stats0 = struct( ...
10    'flag',[], ...
11    'rank',[],...
12    'rank_spqr',[], ...
13    'tol',[],...
14    'tol_alt',[], ...
15    'normest_A',[],...
16    'normest_R',[],...
17    'est_sval_upper_bounds',[], ...
18    'est_sval_lower_bounds',[],...
19    'est_svals_of_R',[], ...
20    'est_svals',[],...
21    'est_error_bounds',[],...
22    'sval_numbers_for_bounds',[], ...
23    'est_norm_A_times_N',[],...
24    'est_err_bound_norm_A_times_N',[], ...
25    'est_norm_A_transpose_times_NT',[],...
26    'est_err_bound_norm_A_transpose_times_NT',[],...
27    'norm_R_times_N',[], ...
28    'norm_R_transpose_times_NT',[],...
29    'iters',[], ...
30    'nsvals_large_found',[],...
31    'final_blocksize',[]',...
32    'ssi_max_block_used',[], ...
33    'ssi_min_block_used',[],...
34    'stats_spqr_basic',[], ...
35    'stats_spqr_null',[],...
36    'info_spqr1',[], ...
37    'info_spqr2',[],...
38    'stats_ssi',[], ...
39    'stats_ssp_N',[], ...
40    'stats_ssp_NT',[],...
41    'opts_used',[], ...
42    'time',[],...
43    'time_initialize',[], ...
44    'time_basis',[], ...
45    'time_iters',[],...
46    'time_est_error_bounds',[], ...
47    'time_svd',[]...
48    );
49
50% MATLAB's orderfields(stats,stats0) requires that stats and stats0 have the
51%   same fields. The following command requires that the set of fields of
52%   stats is a subset of the set of fields of stats0.
53stats = orderfields( stats, ...
54    rmfield( stats0 , setdiff( fieldnames(stats0), fieldnames(stats) ) ) ) ;
55
56