Mercurial > repos > public > sbplib
comparison +noname/testCfl.m @ 230:2dd9cfad2cac feature/beams
improved printing in silent mode.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 01 Jul 2016 09:46:02 +0200 |
parents | de8bcef865b0 |
children | 7f6f04bfc007 |
comparison
equal
deleted
inserted
replaced
229:af3bd542d550 | 230:2dd9cfad2cac |
---|---|
25 if ~ok | 25 if ~ok |
26 error('The lower bound on alpha is unstable!'); | 26 error('The lower bound on alpha is unstable!'); |
27 end | 27 end |
28 end | 28 end |
29 | 29 |
30 if silentFlag | |
31 rsInterval = util.ReplaceableString(''); | |
32 end | |
33 | |
30 % Use bisection to find sharp estimate | 34 % Use bisection to find sharp estimate |
31 while( (alpha0(2)-alpha0(1))/alpha0(1) > tol) | 35 while( (alpha0(2)-alpha0(1))/alpha0(1) > tol) |
32 alpha = mean(alpha0); | 36 alpha = mean(alpha0); |
33 | 37 |
34 if ~silentFlag | 38 if ~silentFlag |
35 fprintf('[%.3e,%.3e]: ', alpha0(1), alpha0(2)); | 39 fprintf('[%.3e,%.3e]: ', alpha0(1), alpha0(2)); |
40 else | |
41 rsInterval.update('[%.3e,%.3e]: ', alpha0(1), alpha0(2)); | |
36 end | 42 end |
37 | 43 |
38 [ok, n_step, maxVal] = testAlpha(alpha); | 44 [ok, n_step, maxVal] = testAlpha(alpha); |
39 | 45 |
40 if ok | 46 if ok |
41 alpha0(1) = alpha; | 47 alpha0(1) = alpha; |
48 stability = 'STABLE'; | |
42 else | 49 else |
43 alpha0(2) = alpha; | 50 alpha0(2) = alpha; |
44 end | |
45 | |
46 if ok | |
47 stability = 'STABLE'; | |
48 else | |
49 stability = 'UNSTABLE'; | 51 stability = 'UNSTABLE'; |
50 end | 52 end |
51 | 53 |
52 if ~silentFlag | 54 if ~silentFlag |
53 fprintf('a = %.3e, n_step=%d %8s max = %.2e\n', alpha, n_step, stability, maxVal); | 55 fprintf('a = %.3e, n_step=%d %8s max = %.2e\n', alpha, n_step, stability, maxVal); |
54 end | 56 end |
55 end | 57 end |
56 | 58 |
57 if silentFlag | 59 if silentFlag |
58 fprintf('Last calculated: a = %.3e, n_step=%d max = %.2e\n', alpha, n_step, maxVal); | 60 rsInterval = util.ReplaceableString(''); |
61 fprintf('a = %.3e, n_step=%d max = %.2e\n', alpha, n_step, maxVal); | |
59 end | 62 end |
60 | 63 |
61 fprintf('T = %-3d dof = %-4d order = %d: clf = %.4e\n',T, discr.size(), discr.order, alpha0(1)); | 64 fprintf('T = %-3d dof = %-4d order = %d: clf = %.4e\n',T, discr.size(), discr.order, alpha0(1)); |
62 | 65 |
63 end | 66 end |